Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rollup of 3 pull requests #129801

Closed
wants to merge 205 commits into from
Closed
Changes from 1 commit
Commits
Show all changes
205 commits
Select commit Hold shift + click to select a range
c1245e1
Add new assist toggle_macro_delimiter
alibektas Aug 1, 2024
662f02f
Make toggle_macro_delimiters work only for macro_calls
alibektas Aug 2, 2024
aa6e8d3
Allow declaring cfg groups in rust-project.json, to help sharing comm…
ChayimFriedman2 Aug 11, 2024
5e058db
docs: Add a doc comment for OpQueue
Wilfred Aug 13, 2024
54ecca0
Auto merge of #17885 - Wilfred:op_queue_docs, r=lnicola
bors Aug 14, 2024
4a14155
Be more resilient to bad language item definitions in binop inference
lnicola Aug 14, 2024
e2f2e73
Auto merge of #17891 - lnicola:binop-bad-lang-items, r=flodiebold
bors Aug 14, 2024
81b68b2
fix: Panic while canonicalizing erroneous projection type
ShoyuVanilla Aug 14, 2024
89cd585
Auto merge of #17882 - ShoyuVanilla:issue-17866, r=lnicola
bors Aug 14, 2024
b0183f8
fix: Panic while displaying associated function with a type annotation
ShoyuVanilla Aug 14, 2024
e20180d
Auto merge of #17893 - ShoyuVanilla:issue-17871, r=flodiebold
bors Aug 15, 2024
a783e30
internal: Properly check the edition for edition dependent syntax kinds
Veykril Aug 15, 2024
a594a2d
Auto merge of #17896 - Veykril:editioned-syntax-kinds, r=Veykril
bors Aug 15, 2024
bf4d31d
Add scip/lsif flag to exclude vendored libaries
darichey Aug 15, 2024
23c8dcd
Allow flycheck process to exit gracefully
tmandry Aug 15, 2024
642a0f8
Replace once_cell with std's recently stabilized OnceCell/Lock and La…
ChayimFriedman2 Aug 16, 2024
0cbf6a7
Test for word boundary in `FindUsages`
ChayimFriedman2 Aug 16, 2024
b68992a
Auto merge of #17907 - ChayimFriedman2:no-once_cell, r=Veykril
bors Aug 16, 2024
95f5e4b
Auto merge of #17908 - ChayimFriedman2:usages-word-boundaries, r=Veykril
bors Aug 16, 2024
fdd5294
Auto merge of #17903 - tmandry:graceful-exit, r=Veykril
bors Aug 16, 2024
4ca597a
implement basic inferring of lifetimes
dfireBird Jun 29, 2024
2071778
Auto merge of #17595 - dfireBird:infer-lt, r=flodiebold
bors Aug 16, 2024
3d6129d
Properly account for editions in names
ChayimFriedman2 Aug 15, 2024
6908451
Auto merge of #17905 - ChayimFriedman2:edition-dependent-raw-keyword,…
bors Aug 16, 2024
995a014
Auto merge of #17900 - darichey:exclude-vendored-libraries, r=davidba…
bors Aug 16, 2024
6fc487d
Remove rust-analyzer.workspace.discoverProjectRunner
darichey Aug 16, 2024
01245bd
Auto merge of #17909 - darichey:remove-discoverProjectRunner, r=lnicola
bors Aug 16, 2024
d3fa5e9
Pin `rowan` to `0.15.15`
ShoyuVanilla Aug 17, 2024
d2d41b4
Auto merge of #17917 - ShoyuVanilla:pin-rowan, r=lnicola
bors Aug 17, 2024
c4b8c65
fix: Wrong BoundVar index when lowering impl trait parameter of paren…
ShoyuVanilla Aug 17, 2024
eb12861
Auto merge of #17916 - ShoyuVanilla:issue-17711, r=Veykril
bors Aug 17, 2024
d0ce97f
feat: Make rust-analyzer work partially when missing an internet conn…
Veykril Aug 17, 2024
324cf83
Adress new clippy::large_enum_variant diagnostics
Veykril Aug 17, 2024
51e3775
Auto merge of #17915 - Veykril:offline-no-deps, r=Veykril
bors Aug 17, 2024
74db4d3
Include generics when lowering extern type
darichey Aug 18, 2024
4abdcd7
provenance_gc: fix comment
RalfJung Aug 19, 2024
4001f59
make the cleanup functions private
RalfJung Aug 19, 2024
2c18533
Auto merge of #17925 - darichey:issue-17767, r=Veykril
bors Aug 19, 2024
1bfb362
chore(config): remove `invocationLocation` in favor of `invocationStr…
Tyrubias Aug 14, 2024
85f6d15
Auto merge of #17888 - Tyrubias:remove-invocation-location, r=Veykril
bors Aug 19, 2024
036affc
fix: keep comments in convert_while_to_loop
roife Aug 19, 2024
05f5c77
Auto merge of #17928 - roife:fix-issue-17869, r=Veykril
bors Aug 19, 2024
b2062ea
Improve documentation for `InvocationStrategy`
Veykril Aug 19, 2024
f17e9a0
Auto merge of #17929 - Veykril:invocation-loc-docs, r=Veykril
bors Aug 19, 2024
bd6ea75
Remove the ability to configure the user config path
Veykril Aug 19, 2024
879fa66
Allow user config to not exist
Veykril Aug 19, 2024
ea12d79
fix: Panic when a TAIT exists in a RPIT
ShoyuVanilla Aug 18, 2024
f9c0c8a
Auto merge of #17924 - ShoyuVanilla:issue-17921, r=Veykril
bors Aug 19, 2024
f25cb80
ServerStatusParams should consider 'prime caches' in quiescent status
Wilfred Aug 13, 2024
df6ce96
Auto merge of #17886 - Wilfred:prime_caches_quiescent, r=Veykril
bors Aug 19, 2024
a7d15a8
fix: Fix panics for semantic highlighting at startup
Veykril Aug 20, 2024
a9e3555
Auto merge of #17932 - Veykril:default-reply-lat-sensitive, r=Veykril
bors Aug 20, 2024
a42c732
Define workspace level configs.
alibektas Aug 16, 2024
8e31598
Next up : generating configs for workspace level configs
alibektas Aug 16, 2024
1b2eaa5
Old configs are back
alibektas Aug 17, 2024
085aac3
Auto merge of #17930 - Veykril:config-user-config, r=alibektas
bors Aug 20, 2024
9cb66c2
Auto merge of #17913 - alibektas:ratoml_improvements, r=alibektas
bors Aug 20, 2024
94f206a
Run flycheck only on crate if target is binary.
alibektas Aug 20, 2024
3f89eeb
internal: Implement `module_path` macro
Veykril Aug 21, 2024
db2e8e1
fix: Wrong `Sized` predicate for `generic_predicates_for_param`
ShoyuVanilla Aug 21, 2024
614fb24
Auto merge of #17939 - ShoyuVanilla:maybe-sized-fix, r=Veykril
bors Aug 22, 2024
f845536
Remove DescendPreference::SameText
Veykril Aug 22, 2024
d893dcc
Drop MacroInputKind
Veykril Aug 22, 2024
aeb9c7b
Implement floating point casts in const eval
HKalbasi Aug 22, 2024
1179cbb
Remove DescendPreference::SameKind
Veykril Aug 22, 2024
8e82e44
Fully remove old macro descension API
Veykril Aug 22, 2024
e698ca1
fix a misleading comment in TB tests
sun-jacobi Aug 22, 2024
4d61444
Rename macro descension functions
Veykril Aug 22, 2024
d79999a
Thread file id through descension API for semantic highlighting
Veykril Aug 22, 2024
b0e7ef4
Sort hover results by relevance
Veykril Aug 22, 2024
3a423fc
Avoid extra copy by using `retain_mut` and moving the deletion into t…
JoJoDeveloping Aug 22, 2024
e881c42
Auto merge of #3834 - sun-jacobi:tb-comment, r=RalfJung
bors Aug 22, 2024
f9db48f
Consider interleaving hover kinds
Veykril Aug 22, 2024
b8c02eb
Auto merge of #3835 - JoJoDeveloping:tb-fix-stack-overflow, r=RalfJung
bors Aug 22, 2024
06228b9
Auto merge of #17942 - HKalbasi:fp-const-eval, r=HKalbasi
bors Aug 22, 2024
71c7cea
Fix sorting order for tokens in hover
Veykril Aug 22, 2024
81a9956
Auto merge of #17898 - Veykril:descend-2.0, r=Veykril
bors Aug 22, 2024
0a27711
Improve proc-macro panic message and workspace loading failure diagno…
Veykril Aug 22, 2024
1b0e158
Auto merge of #17943 - Veykril:diags, r=Veykril
bors Aug 22, 2024
f65d605
When descending into macros in search, first check if there is a need…
ChayimFriedman2 Aug 16, 2024
a57def2
Speed up search for short associated functions, especially very commo…
ChayimFriedman2 Aug 18, 2024
a44152a
Add cov_marks to test #17927
ChayimFriedman2 Aug 22, 2024
0251cfa
Apply changes
alibektas Aug 22, 2024
b88a4f0
Auto merge of #17912 - alibektas:cargo_check_on_binary, r=Veykril
bors Aug 23, 2024
916c559
Remove incorrect FIXME comment
Veykril Aug 23, 2024
39cc5b6
Auto merge of #17927 - ChayimFriedman2:speedup-new-usages, r=Veykril
bors Aug 23, 2024
ac912c7
Auto merge of #17936 - Veykril:module_path, r=Veykril
bors Aug 23, 2024
5f7489a
internal: Don't requery crates_for for flycheck when crates are known
Veykril Aug 23, 2024
e030cf0
Auto merge of #17946 - Veykril:flycheck-crates-for, r=Veykril
bors Aug 23, 2024
3a097e1
Auto merge of #17857 - ChayimFriedman2:rust-project-cfg-group, r=Veykril
bors Aug 23, 2024
eb896a5
fix: Wrong `Self: Sized` predicate for trait assoc items
ShoyuVanilla Aug 23, 2024
3bd42d3
Auto merge of #17948 - ShoyuVanilla:parent-self-sized, r=Veykril
bors Aug 23, 2024
bdbc057
Include buildfile path in watcher list
Wilfred Aug 23, 2024
a074e1a
Auto merge of #17949 - Wilfred:include_build_file_in_watchers, r=lnicola
bors Aug 24, 2024
7f968ba
fix calling pipe, pipe2, socketpair with a pointer-to-array
RalfJung Aug 24, 2024
17659eb
Auto merge of #3840 - RalfJung:pipe-to-array, r=RalfJung
bors Aug 24, 2024
14f22c6
epoll: Add EINVAL case
tiif Aug 23, 2024
3a9e63c
Auto merge of #3836 - tiif:einval_ctl, r=oli-obk
bors Aug 24, 2024
23f308b
Handle edge case for epoll_ctl
tiif Aug 20, 2024
dbfd066
Auto merge of #3829 - tiif:edgecase, r=oli-obk
bors Aug 24, 2024
f71cdbb
Support blocking for epoll
tiif Aug 19, 2024
e8175a4
Improve comment
tiif Aug 24, 2024
41ab4ec
Pass dest place reference to epoll_wait
tiif Aug 24, 2024
36235b9
Rename event to events
tiif Aug 24, 2024
cd67e47
Fix error in the timeout value error message
tiif Aug 24, 2024
8f178e4
Change timeout value
tiif Aug 24, 2024
7aff711
Check if the thread is blocked before waking them up
tiif Aug 24, 2024
a4d7564
Fix error introduced by rebase
tiif Aug 24, 2024
7e8ca57
Remove thread_id from epoll::thread_ids after timeout
tiif Aug 24, 2024
25ca855
Make blocking_epoll_callback a private function
tiif Aug 24, 2024
7d5be06
Add 0 preemption rate flag for blocking test and fix comment
tiif Aug 24, 2024
09993ce
Add 0 preemption rate flag
tiif Aug 24, 2024
12faedd
Fix few bugs in closure capture computation, and add tests
ChayimFriedman2 Aug 24, 2024
77ab568
Preserve all spans for closure captures, not just one
ChayimFriedman2 Aug 24, 2024
cf243e5
Add `gen` modifier to functions
ChayimFriedman2 Aug 22, 2024
1e0df17
Handle associated types that are lang items
ChayimFriedman2 Aug 22, 2024
2c6a521
Provide `Future::Output` and `Iterator` lang items
ChayimFriedman2 Aug 22, 2024
737a969
Add helper methods to retrieve `Future::Output` and `Iterator::Item`
ChayimFriedman2 Aug 22, 2024
7339337
Modify `hacks::parse_expr_from_str()` to take an edition too
ChayimFriedman2 Aug 22, 2024
6340522
Provide `impl From<ast::TypeOrConstParam> for ast::GenericParam`
ChayimFriedman2 Aug 22, 2024
becfc5a
Impl PartialEq and Eq for `IndentLevel`
ChayimFriedman2 Aug 22, 2024
7bd3ca1
Don't enable the search fast path for short associated functions when…
ChayimFriedman2 Aug 25, 2024
cba00a8
Auto merge of #17955 - ChayimFriedman2:fix-fast-search-with-scope, r=…
bors Aug 25, 2024
d9d8d94
fix: Fix metadata retrying eating original errors
Veykril Aug 25, 2024
c223013
Auto merge of #17956 - Veykril:metadata-err, r=Veykril
bors Aug 25, 2024
606401f
fix: Fix trait method completions not acknowledging Deref impls
Veykril Aug 25, 2024
bdee5c9
Auto merge of #17958 - Veykril:deref-chain-method-completions, r=Veykril
bors Aug 25, 2024
0ed13eb
Add test for triggering notification after timeout
tiif Aug 25, 2024
2703ea1
fix: add extra_test_bin_args to test explorer test runner
Aug 25, 2024
98e23d3
internal: Don't allocate autoderef steps when not needed
Veykril Aug 25, 2024
31a532a
Auto merge of #17961 - Veykril:autoderef-alloc, r=Veykril
bors Aug 25, 2024
e0b1719
Auto merge of #17960 - duncanawoods:master, r=HKalbasi
bors Aug 25, 2024
326a1c6
Fix Return Type Syntax to include `..` (i.e. `method(..)` and not `me…
ChayimFriedman2 Aug 25, 2024
e01bc04
Preparing for merge from rustc
Aug 26, 2024
55fba66
Merge from rustc
Aug 26, 2024
a3f1196
Auto merge of #17962 - ChayimFriedman2:update-rtn, r=Veykril
bors Aug 26, 2024
9fb611c
silence an overreaching clippy lint
RalfJung Aug 26, 2024
2f13379
Auto merge of #3844 - rust-lang:rustup-2024-08-26, r=RalfJung
bors Aug 26, 2024
239dc5d
Auto merge of #17941 - ChayimFriedman2:pre-closure-to-fn, r=Veykril
bors Aug 26, 2024
9dad25a
Show and render error lifetime args as `'_`
avrong Aug 26, 2024
9d4fdc0
Show lifetime args if there are only error ones
avrong Aug 26, 2024
05e6fb6
Auto merge of #17963 - avrong:avrong/error-lifetimes, r=Veykril
bors Aug 26, 2024
65e9f8b
Fix "Unwrap block" assist with block modifiers
ChayimFriedman2 Aug 26, 2024
25e5ac4
Disable tree traversal optimization that is wrong due to lazy nodes.
JoJoDeveloping Aug 26, 2024
0763a3a
Bump backtrace to rust-lang/backtrace@fc37b22
workingjubilee Aug 27, 2024
65d25fe
Revert "feat: Implement `module_path` macro"
Veykril Aug 27, 2024
f0bfd43
Auto merge of #17972 - rust-lang:revert-17936-module_path, r=Veykril
bors Aug 27, 2024
eb7bf6e
Auto merge of #3827 - RalfJung:gc-comment, r=RalfJung
bors Aug 27, 2024
6593688
Auto merge of #17970 - ChayimFriedman2:unwrap-unsafe-block, r=Veykril
bors Aug 27, 2024
6f8fb3c
tree_borrows test: ensure we can actually read the variable
RalfJung Aug 27, 2024
9f35309
Auto merge of #3849 - RalfJung:tb-test, r=RalfJung
bors Aug 27, 2024
df4580b
Expand proc-macros in workspace root, not package root
Veykril Aug 27, 2024
b592256
Drop Apache license appendices
lnicola Aug 27, 2024
e4c404e
Auto merge of #17973 - Veykril:proc-macro-curr-dir, r=Veykril
bors Aug 27, 2024
2dce250
Auto merge of #17974 - lnicola:rm-apache-appendix, r=lnicola
bors Aug 27, 2024
664640f
Add testcase for #3846
JoJoDeveloping Aug 27, 2024
c9a3b02
Fix tests
Veykril Aug 27, 2024
9b82f3b
Auto merge of #3847 - JoJoDeveloping:master, r=RalfJung
bors Aug 27, 2024
199c01d
Auto merge of #17757 - alibektas:toggle_macro_delimiters, r=Veykril
bors Aug 27, 2024
2765444
Make TB tree traversal bottom-up
JoJoDeveloping Aug 25, 2024
34e50f5
Create an assist to convert closure to freestanding fn
ChayimFriedman2 Aug 22, 2024
5be5cec
Add explanation to TB's "piecewise bottom-up" traversal
JoJoDeveloping Aug 27, 2024
4318bfe
Auto merge of #3843 - JoJoDeveloping:tb-bottom-up-iteration, r=RalfJung
bors Aug 27, 2024
e26779e
Make Tree Borrows Provenance GC compact the tree
JoJoDeveloping Aug 23, 2024
2d69baa
Auto merge of #3804 - tiif:blockit, r=oli-obk
bors Aug 27, 2024
ae3c270
Preparing for merge from rustc
Aug 28, 2024
f4f3447
Merge from rustc
Aug 28, 2024
3a655aa
Auto merge of #3850 - rust-lang:rustup-2024-08-28, r=RalfJung
bors Aug 28, 2024
abcfc17
Add test for tokio file io and mpsc
tiif Aug 27, 2024
79115f5
Auto merge of #3848 - tiif:tokiotest, r=RalfJung
bors Aug 28, 2024
51055f7
Fix cwd used for proc macro expansion
lnicola Aug 28, 2024
e34f35e
Add benchmark for TB slowdown
JoJoDeveloping Aug 27, 2024
248a557
Auto merge of #17981 - lnicola:proc-macro-cwd, r=Veykril
bors Aug 28, 2024
84134c6
address nits
JoJoDeveloping Aug 28, 2024
9ad0f65
Auto merge of #3837 - JoJoDeveloping:tb-compacting-provenance-gc, r=R…
bors Aug 28, 2024
4880eee
Fix name resolution of shadowed builtin macro
ChayimFriedman2 Aug 28, 2024
2a7ec0b
Consider all expressions that autoderef in "Extract variable", not ju…
ChayimFriedman2 Aug 28, 2024
fe5f91e
Don't add reference when it isn't needed for the "Extract variable" a…
ChayimFriedman2 Aug 28, 2024
5aefe78
internal: Avoid newlines in fetch workspace errors
Wilfred Aug 28, 2024
3ff3d39
Also handle deref expressions in "Extract variable"
ChayimFriedman2 Aug 28, 2024
b3fcd8e
Consider field attributes when converting from tuple to named struct …
ChayimFriedman2 Aug 28, 2024
c2c1bd0
Fix incorrect symbol definitions in SCIP output
darichey Aug 28, 2024
3a14e30
Auto merge of #17992 - Wilfred:newlines_in_logs, r=Veykril
bors Aug 29, 2024
b0c3324
Preparing for merge from rustc
Aug 29, 2024
a10633a
Merge from rustc
Aug 29, 2024
b5be3ab
fix wasm test
RalfJung Aug 29, 2024
ad7a1aa
Auto merge of #3851 - rust-lang:rustup-2024-08-29, r=RalfJung
bors Aug 29, 2024
14ec120
fix: Fix proc-macro server crashing when parsing a non-lexable string…
Veykril Aug 29, 2024
03d6745
fix: Fix TokenStream::to_string implementation dropping quotation marks
Veykril Aug 29, 2024
266bb1f
Auto merge of #17994 - Veykril:proc-macro-srv-from-str-panic, r=Veykril
bors Aug 29, 2024
2ec71c8
Preparing for merge from rust-lang/rust
lnicola Aug 29, 2024
26888c3
Merge from rust-lang/rust
lnicola Aug 29, 2024
f05888d
Auto merge of #17995 - lnicola:sync-from-rust, r=lnicola
bors Aug 29, 2024
b195ff3
Auto merge of #17940 - ChayimFriedman2:closure-to-fn, r=Veykril
bors Aug 29, 2024
e0625d5
Auto merge of #17988 - darichey:fix-scip-def, r=Veykril
bors Aug 29, 2024
b6d0fd0
Auto merge of #17987 - ChayimFriedman2:column-macro, r=Veykril
bors Aug 29, 2024
cd377d9
Auto merge of #17991 - ChayimFriedman2:extract-variable-ref, r=Veykril
bors Aug 29, 2024
34e7e79
Auto merge of #17993 - ChayimFriedman2:convert-to-tuple-attrs, r=Veykril
bors Aug 29, 2024
518b41c
Try latest backtrace
workingjubilee Aug 29, 2024
0453d9b
Preparing for merge from rustc
Aug 30, 2024
23f4eae
Merge from rustc
Aug 30, 2024
f03c7b2
Auto merge of #3853 - rust-lang:rustup-2024-08-30, r=saethlin
bors Aug 30, 2024
d658a40
Rollup merge of #129642 - workingjubilee:bump-backtrace-fc37b22, r=wo…
workingjubilee Aug 31, 2024
a8616b9
Rollup merge of #129733 - lnicola:sync-from-ra, r=lnicola
workingjubilee Aug 31, 2024
296e85f
Rollup merge of #129785 - RalfJung:miri-sync, r=RalfJung
workingjubilee Aug 31, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Replace once_cell with std's recently stabilized OnceCell/Lock and La…
…zyCell/Lock

This doesn't get rid of the once_cell dependency, unfortunately, since we have dependencies that use it, but it's a nice to do cleanup. And when our deps will eventually get rid of once_cell we will get rid of it for free.
ChayimFriedman2 committed Aug 16, 2024
commit 642a0f84ca2f52c6e694ee9549379b86f7c04fd0
7 changes: 0 additions & 7 deletions src/tools/rust-analyzer/Cargo.lock
Original file line number Diff line number Diff line change
@@ -495,7 +495,6 @@ dependencies = [
"hir-ty",
"intern",
"itertools",
"once_cell",
"rustc-hash",
"smallvec",
"span",
@@ -528,7 +527,6 @@ dependencies = [
"la-arena 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
"limit",
"mbe",
"once_cell",
"ra-ap-rustc_abi",
"ra-ap-rustc_parse_format",
"rustc-hash",
@@ -595,7 +593,6 @@ dependencies = [
"la-arena 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
"limit",
"nohash-hasher",
"once_cell",
"oorandom",
"project-model",
"ra-ap-rustc_abi",
@@ -691,7 +688,6 @@ dependencies = [
"hir",
"ide-db",
"itertools",
"once_cell",
"smallvec",
"stdx",
"syntax",
@@ -720,7 +716,6 @@ dependencies = [
"line-index 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
"memchr",
"nohash-hasher",
"once_cell",
"parser",
"profile",
"rayon",
@@ -746,7 +741,6 @@ dependencies = [
"hir",
"ide-db",
"itertools",
"once_cell",
"paths",
"serde_json",
"stdx",
@@ -1938,7 +1932,6 @@ dependencies = [
"expect-test",
"indexmap",
"itertools",
"once_cell",
"parser",
"ra-ap-rustc_lexer",
"rayon",
1 change: 0 additions & 1 deletion src/tools/rust-analyzer/crates/hir-def/Cargo.toml
Original file line number Diff line number Diff line change
@@ -23,7 +23,6 @@ fst = { version = "0.4.7", default-features = false }
indexmap.workspace = true
itertools.workspace = true
la-arena.workspace = true
once_cell = "1.17.0"
rustc-hash.workspace = true
tracing.workspace = true
smallvec.workspace = true
24 changes: 15 additions & 9 deletions src/tools/rust-analyzer/crates/hir-def/src/generics.rs
Original file line number Diff line number Diff line change
@@ -12,7 +12,6 @@ use hir_expand::{
};
use intern::Interned;
use la_arena::{Arena, RawIdx};
use once_cell::unsync::Lazy;
use stdx::impl_from;
use syntax::ast::{self, HasGenericParams, HasName, HasTypeBounds};
use triomphe::Arc;
@@ -394,11 +393,16 @@ impl GenericParams {

// Don't create an `Expander` if not needed since this
// could cause a reparse after the `ItemTree` has been created due to the spanmap.
let mut expander = Lazy::new(|| {
(module.def_map(db), Expander::new(db, loc.id.file_id(), module))
});
let mut expander = None;
for param in func_data.params.iter() {
generic_params.fill_implicit_impl_trait_args(db, &mut expander, param);
generic_params.fill_implicit_impl_trait_args(
db,
&mut expander,
&mut || {
(module.def_map(db), Expander::new(db, loc.id.file_id(), module))
},
param,
);
}
Interned::new(generic_params.finish())
}
@@ -597,7 +601,9 @@ impl GenericParamsCollector {
fn fill_implicit_impl_trait_args(
&mut self,
db: &dyn DefDatabase,
exp: &mut Lazy<(Arc<DefMap>, Expander), impl FnOnce() -> (Arc<DefMap>, Expander)>,
// FIXME: Change this back to `LazyCell` if https://github.com/rust-lang/libs-team/issues/429 is accepted.
exp: &mut Option<(Arc<DefMap>, Expander)>,
exp_fill: &mut dyn FnMut() -> (Arc<DefMap>, Expander),
type_ref: &TypeRef,
) {
type_ref.walk(&mut |type_ref| {
@@ -617,7 +623,7 @@ impl GenericParamsCollector {
}
if let TypeRef::Macro(mc) = type_ref {
let macro_call = mc.to_node(db.upcast());
let (def_map, expander) = &mut **exp;
let (def_map, expander) = exp.get_or_insert_with(&mut *exp_fill);

let module = expander.module.local_id;
let resolver = |path: &_| {
@@ -637,8 +643,8 @@ impl GenericParamsCollector {
{
let ctx = expander.ctx(db);
let type_ref = TypeRef::from_ast(&ctx, expanded.tree());
self.fill_implicit_impl_trait_args(db, &mut *exp, &type_ref);
exp.1.exit(mark);
self.fill_implicit_impl_trait_args(db, &mut *exp, exp_fill, &type_ref);
exp.get_or_insert_with(&mut *exp_fill).1.exit(mark);
}
}
});
5 changes: 3 additions & 2 deletions src/tools/rust-analyzer/crates/hir-def/src/item_scope.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
//! Describes items defined or visible (ie, imported) in a certain scope.
//! This is shared between modules and blocks.
use std::sync::LazyLock;

use base_db::CrateId;
use hir_expand::{attrs::AttrId, db::ExpandDatabase, name::Name, AstId, MacroCallId};
use indexmap::map::Entry;
use itertools::Itertools;
use la_arena::Idx;
use once_cell::sync::Lazy;
use rustc_hash::{FxHashMap, FxHashSet};
use smallvec::{smallvec, SmallVec};
use stdx::format_to;
@@ -129,7 +130,7 @@ struct DeriveMacroInvocation {
derive_call_ids: SmallVec<[Option<MacroCallId>; 1]>,
}

pub(crate) static BUILTIN_SCOPE: Lazy<FxIndexMap<Name, PerNs>> = Lazy::new(|| {
pub(crate) static BUILTIN_SCOPE: LazyLock<FxIndexMap<Name, PerNs>> = LazyLock::new(|| {
BuiltinType::all_builtin_types()
.iter()
.map(|(name, ty)| (name.clone(), PerNs::types((*ty).into(), Visibility::Public, None)))
12 changes: 6 additions & 6 deletions src/tools/rust-analyzer/crates/hir-def/src/item_tree.rs
Original file line number Diff line number Diff line change
@@ -40,6 +40,7 @@ use std::{
fmt::{self, Debug},
hash::{Hash, Hasher},
ops::{Index, Range},
sync::OnceLock,
};

use ast::{AstNode, StructKind};
@@ -48,7 +49,6 @@ use either::Either;
use hir_expand::{attrs::RawAttrs, name::Name, ExpandTo, HirFileId, InFile};
use intern::{Interned, Symbol};
use la_arena::{Arena, Idx, RawIdx};
use once_cell::sync::OnceCell;
use rustc_hash::FxHashMap;
use smallvec::SmallVec;
use span::{AstIdNode, FileAstId, SyntaxContextId};
@@ -101,7 +101,7 @@ pub struct ItemTree {
impl ItemTree {
pub(crate) fn file_item_tree_query(db: &dyn DefDatabase, file_id: HirFileId) -> Arc<ItemTree> {
let _p = tracing::info_span!("file_item_tree_query", ?file_id).entered();
static EMPTY: OnceCell<Arc<ItemTree>> = OnceCell::new();
static EMPTY: OnceLock<Arc<ItemTree>> = OnceLock::new();

let syntax = db.parse_or_expand(file_id);

@@ -152,7 +152,7 @@ impl ItemTree {

pub(crate) fn block_item_tree_query(db: &dyn DefDatabase, block: BlockId) -> Arc<ItemTree> {
let _p = tracing::info_span!("block_item_tree_query", ?block).entered();
static EMPTY: OnceCell<Arc<ItemTree>> = OnceCell::new();
static EMPTY: OnceLock<Arc<ItemTree>> = OnceLock::new();

let loc = block.lookup(db);
let block = loc.ast_id.to_node(db.upcast());
@@ -626,9 +626,9 @@ impl Index<RawVisibilityId> for ItemTree {
type Output = RawVisibility;
fn index(&self, index: RawVisibilityId) -> &Self::Output {
static VIS_PUB: RawVisibility = RawVisibility::Public;
static VIS_PRIV_IMPLICIT: OnceCell<RawVisibility> = OnceCell::new();
static VIS_PRIV_EXPLICIT: OnceCell<RawVisibility> = OnceCell::new();
static VIS_PUB_CRATE: OnceCell<RawVisibility> = OnceCell::new();
static VIS_PRIV_IMPLICIT: OnceLock<RawVisibility> = OnceLock::new();
static VIS_PRIV_EXPLICIT: OnceLock<RawVisibility> = OnceLock::new();
static VIS_PUB_CRATE: OnceLock<RawVisibility> = OnceLock::new();

match index {
RawVisibilityId::PRIV_IMPLICIT => VIS_PRIV_IMPLICIT.get_or_init(|| {
1 change: 0 additions & 1 deletion src/tools/rust-analyzer/crates/hir-ty/Cargo.toml
Original file line number Diff line number Diff line change
@@ -29,7 +29,6 @@ chalk-ir.workspace = true
chalk-recursive.workspace = true
chalk-derive.workspace = true
la-arena.workspace = true
once_cell = "1.17.0"
triomphe.workspace = true
nohash-hasher.workspace = true
typed-arena = "2.0.1"
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
//! Interface with `rustc_pattern_analysis`.
use std::cell::LazyCell;
use std::fmt;

use hir_def::{DefWithBodyId, EnumId, EnumVariantId, HasModule, LocalFieldId, ModuleId, VariantId};
use intern::sym;
use once_cell::unsync::Lazy;
use rustc_pattern_analysis::{
constructor::{Constructor, ConstructorSet, VariantVisibility},
usefulness::{compute_match_usefulness, PlaceValidity, UsefulnessReport},
@@ -388,8 +388,9 @@ impl<'db> PatCx for MatchCheckCtx<'db> {
let variant = Self::variant_id_for_adt(self.db, ctor, adt).unwrap();

// Whether we must not match the fields of this variant exhaustively.
let is_non_exhaustive = Lazy::new(|| self.is_foreign_non_exhaustive(adt));
let visibilities = Lazy::new(|| self.db.field_visibilities(variant));
let is_non_exhaustive =
LazyCell::new(|| self.is_foreign_non_exhaustive(adt));
let visibilities = LazyCell::new(|| self.db.field_visibilities(variant));

self.list_variant_fields(ty, variant)
.map(move |(fid, ty)| {
3 changes: 1 addition & 2 deletions src/tools/rust-analyzer/crates/hir-ty/src/infer.rs
Original file line number Diff line number Diff line change
@@ -22,7 +22,7 @@ mod pat;
mod path;
pub(crate) mod unify;

use std::{convert::identity, iter, ops::Index};
use std::{cell::OnceCell, convert::identity, iter, ops::Index};

use chalk_ir::{
cast::Cast,
@@ -50,7 +50,6 @@ use hir_expand::name::Name;
use indexmap::IndexSet;
use intern::sym;
use la_arena::{ArenaMap, Entry};
use once_cell::unsync::OnceCell;
use rustc_hash::{FxHashMap, FxHashSet};
use stdx::{always, never};
use triomphe::Arc;
3 changes: 1 addition & 2 deletions src/tools/rust-analyzer/crates/hir-ty/src/lower.rs
Original file line number Diff line number Diff line change
@@ -6,7 +6,7 @@
//!
//! This usually involves resolving names, collecting generic arguments etc.
use std::{
cell::{Cell, RefCell, RefMut},
cell::{Cell, OnceCell, RefCell, RefMut},
iter,
ops::{self, Not as _},
};
@@ -43,7 +43,6 @@ use hir_def::{
use hir_expand::{name::Name, ExpandResult};
use intern::Interned;
use la_arena::{Arena, ArenaMap};
use once_cell::unsync::OnceCell;
use rustc_hash::FxHashSet;
use rustc_pattern_analysis::Captures;
use smallvec::SmallVec;
6 changes: 3 additions & 3 deletions src/tools/rust-analyzer/crates/hir-ty/src/tests.rs
Original file line number Diff line number Diff line change
@@ -11,6 +11,7 @@ mod simple;
mod traits;

use std::env;
use std::sync::LazyLock;

use base_db::SourceDatabaseFileInputExt as _;
use expect_test::Expect;
@@ -24,7 +25,6 @@ use hir_def::{
AssocItemId, DefWithBodyId, HasModule, LocalModuleId, Lookup, ModuleDefId,
};
use hir_expand::{db::ExpandDatabase, FileRange, InFile};
use once_cell::race::OnceBool;
use rustc_hash::FxHashMap;
use stdx::format_to;
use syntax::{
@@ -49,8 +49,8 @@ use crate::{
// `env UPDATE_EXPECT=1 cargo test -p hir_ty` to update the snapshots.

fn setup_tracing() -> Option<tracing::subscriber::DefaultGuard> {
static ENABLE: OnceBool = OnceBool::new();
if !ENABLE.get_or_init(|| env::var("CHALK_DEBUG").is_ok()) {
static ENABLE: LazyLock<bool> = LazyLock::new(|| env::var("CHALK_DEBUG").is_ok());
if !*ENABLE {
return None;
}

1 change: 0 additions & 1 deletion src/tools/rust-analyzer/crates/hir/Cargo.toml
Original file line number Diff line number Diff line change
@@ -20,7 +20,6 @@ itertools.workspace = true
smallvec.workspace = true
tracing.workspace = true
triomphe.workspace = true
once_cell = "1.17.1"

# local deps
base-db.workspace = true
1 change: 0 additions & 1 deletion src/tools/rust-analyzer/crates/ide-completion/Cargo.toml
Original file line number Diff line number Diff line change
@@ -17,7 +17,6 @@ cov-mark = "2.0.0-pre.1"
itertools.workspace = true
tracing.workspace = true

once_cell = "1.17.0"
smallvec.workspace = true


Original file line number Diff line number Diff line change
@@ -2,6 +2,8 @@
//!
//! This module uses a bit of static metadata to provide completions for builtin-in attributes and lints.
use std::sync::LazyLock;

use ide_db::{
generated::lints::{
Lint, CLIPPY_LINTS, CLIPPY_LINT_GROUPS, DEFAULT_LINTS, FEATURES, RUSTDOC_LINTS,
@@ -10,7 +12,6 @@ use ide_db::{
FxHashMap, SymbolKind,
};
use itertools::Itertools;
use once_cell::sync::Lazy;
use syntax::{
ast::{self, AttrKind},
AstNode, SyntaxKind, T,
@@ -215,7 +216,7 @@ macro_rules! attrs {
}

#[rustfmt::skip]
static KIND_TO_ATTRIBUTES: Lazy<FxHashMap<SyntaxKind, &[&str]>> = Lazy::new(|| {
static KIND_TO_ATTRIBUTES: LazyLock<FxHashMap<SyntaxKind, &[&str]>> = LazyLock::new(|| {
use SyntaxKind::*;
[
(
1 change: 0 additions & 1 deletion src/tools/rust-analyzer/crates/ide-db/Cargo.toml
Original file line number Diff line number Diff line change
@@ -19,7 +19,6 @@ tracing.workspace = true
rayon.workspace = true
fst = { version = "0.4.7", default-features = false }
rustc-hash.workspace = true
once_cell = "1.17.0"
either.workspace = true
itertools.workspace = true
arrayvec.workspace = true
8 changes: 4 additions & 4 deletions src/tools/rust-analyzer/crates/ide-db/src/search.rs
Original file line number Diff line number Diff line change
@@ -4,6 +4,7 @@
//! get a super-set of matches. Then, we confirm each match using precise
//! name resolution.
use std::cell::LazyCell;
use std::mem;

use base_db::{salsa::Database, SourceDatabase, SourceRootDatabase};
@@ -12,7 +13,6 @@ use hir::{
InFile, InRealFile, ModuleSource, PathResolution, Semantics, Visibility,
};
use memchr::memmem::Finder;
use once_cell::unsync::Lazy;
use parser::SyntaxKind;
use rustc_hash::FxHashMap;
use span::EditionedFileId;
@@ -543,7 +543,7 @@ impl<'a> FindUsages<'a> {

for (text, file_id, search_range) in scope_files(sema, &search_scope) {
self.sema.db.unwind_if_cancelled();
let tree = Lazy::new(move || sema.parse(file_id).syntax().clone());
let tree = LazyCell::new(move || sema.parse(file_id).syntax().clone());

// Search for occurrences of the items name
for offset in match_indices(&text, finder, search_range) {
@@ -589,7 +589,7 @@ impl<'a> FindUsages<'a> {

for (text, file_id, search_range) in scope_files(sema, &scope) {
self.sema.db.unwind_if_cancelled();
let tree = Lazy::new(move || sema.parse(file_id).syntax().clone());
let tree = LazyCell::new(move || sema.parse(file_id).syntax().clone());

for offset in match_indices(&text, finder, search_range) {
for name_ref in
@@ -641,7 +641,7 @@ impl<'a> FindUsages<'a> {
let search_range =
search_range.unwrap_or_else(|| TextRange::up_to(TextSize::of(&*text)));

let tree = Lazy::new(|| sema.parse(file_id).syntax().clone());
let tree = LazyCell::new(|| sema.parse(file_id).syntax().clone());
let finder = &Finder::new("self");

for offset in match_indices(&text, finder, search_range) {
1 change: 0 additions & 1 deletion src/tools/rust-analyzer/crates/ide-diagnostics/Cargo.toml
Original file line number Diff line number Diff line change
@@ -18,7 +18,6 @@ either.workspace = true
itertools.workspace = true
serde_json.workspace = true
tracing.workspace = true
once_cell = "1.17.0"

# local deps
stdx.workspace = true
11 changes: 6 additions & 5 deletions src/tools/rust-analyzer/crates/ide-diagnostics/src/lib.rs
Original file line number Diff line number Diff line change
@@ -75,6 +75,8 @@ mod handlers {
#[cfg(test)]
mod tests;

use std::sync::LazyLock;

use hir::{diagnostics::AnyDiagnostic, InFile, Semantics};
use ide_db::{
assists::{Assist, AssistId, AssistKind, AssistResolveStrategy},
@@ -86,7 +88,6 @@ use ide_db::{
syntax_helpers::node_ext::parse_tt_as_comma_sep_paths,
EditionedFileId, FileId, FileRange, FxHashMap, FxHashSet, RootDatabase, SnippetCap,
};
use once_cell::sync::Lazy;
use stdx::never;
use syntax::{
ast::{self, AstNode},
@@ -512,11 +513,11 @@ pub fn full_diagnostics(

// `__RA_EVERY_LINT` is a fake lint group to allow every lint in proc macros

static RUSTC_LINT_GROUPS_DICT: Lazy<FxHashMap<&str, Vec<&str>>> =
Lazy::new(|| build_group_dict(DEFAULT_LINT_GROUPS, &["warnings", "__RA_EVERY_LINT"], ""));
static RUSTC_LINT_GROUPS_DICT: LazyLock<FxHashMap<&str, Vec<&str>>> =
LazyLock::new(|| build_group_dict(DEFAULT_LINT_GROUPS, &["warnings", "__RA_EVERY_LINT"], ""));

static CLIPPY_LINT_GROUPS_DICT: Lazy<FxHashMap<&str, Vec<&str>>> =
Lazy::new(|| build_group_dict(CLIPPY_LINT_GROUPS, &["__RA_EVERY_LINT"], "clippy::"));
static CLIPPY_LINT_GROUPS_DICT: LazyLock<FxHashMap<&str, Vec<&str>>> =
LazyLock::new(|| build_group_dict(CLIPPY_LINT_GROUPS, &["__RA_EVERY_LINT"], "clippy::"));

fn build_group_dict(
lint_group: &'static [LintGroup],
1 change: 0 additions & 1 deletion src/tools/rust-analyzer/crates/syntax/Cargo.toml
Original file line number Diff line number Diff line change
@@ -18,7 +18,6 @@ either.workspace = true
itertools.workspace = true
rowan = "0.15.15"
rustc-hash.workspace = true
once_cell = "1.17.0"
indexmap.workspace = true
smol_str.workspace = true
triomphe.workspace = true
5 changes: 3 additions & 2 deletions src/tools/rust-analyzer/crates/syntax/src/ast/make.rs
Original file line number Diff line number Diff line change
@@ -1152,12 +1152,13 @@ pub fn token(kind: SyntaxKind) -> SyntaxToken {
}

pub mod tokens {
use once_cell::sync::Lazy;
use std::sync::LazyLock;

use parser::Edition;

use crate::{ast, AstNode, Parse, SourceFile, SyntaxKind::*, SyntaxToken};

pub(super) static SOURCE_FILE: Lazy<Parse<SourceFile>> = Lazy::new(|| {
pub(super) static SOURCE_FILE: LazyLock<Parse<SourceFile>> = LazyLock::new(|| {
SourceFile::parse(
"const C: <()>::Item = ( true && true , true || true , 1 != 1, 2 == 2, 3 < 3, 4 <= 4, 5 > 5, 6 >= 6, !true, *p, &p , &mut p, { let _ @ [] })\n;\n\nimpl A for B where: {}", Edition::CURRENT,
)