Skip to content

Commit 4271f82

Browse files
Rollup merge of #150267 - lnicola:sync-from-ra, r=lnicola
`rust-analyzer` subtree update Subtree update of `rust-analyzer` to rust-lang/rust-analyzer@31d2019. Created using https://github.com/rust-lang/josh-sync. r? `@ghost`
2 parents 520a3c4 + 7eeaa7a commit 4271f82

File tree

189 files changed

+7921
-4346
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

189 files changed

+7921
-4346
lines changed

src/tools/rust-analyzer/CONTRIBUTING.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
> [!IMPORTANT]
2+
> We have enacted a feature freeze for IDE assists to cope with the PR backlog as well as allowing us to prepare for the rowan transition!
3+
> If you submit a PR that **adds** new ide-assists, chances are very high that we will just close it on this basis alone until we have the capacity to deal with them again.
4+
5+
16
# Contributing to rust-analyzer
27

38
Thank you for your interest in contributing to rust-analyzer! There are many ways to contribute
@@ -28,3 +33,11 @@ possibility of someone putting a lot of work into a feature that is then going t
2833
it out of scope (be it due to generally not fitting in with rust-analyzer, or just not having the
2934
maintenance capacity). If there already is a feature issue open but it is not clear whether it is
3035
considered accepted feel free to just drop a comment and ask!
36+
37+
## Use of AI tools
38+
39+
AI tool use is not discouraged on the rust-analyzer codebase, as long as it meets our quality standards.
40+
We kindly ask you to disclose usage of AI tools in your contributions.
41+
If you used them without disclosing it, we may reject your contribution on that basis alone due to the assumption that you likely not reviewed your own submission (so why should we?).
42+
43+
We may still reject AI-assisted contributions if we deem the quality of the contribution to be unsatisfactory as to reduce impact on the team's review budget.

src/tools/rust-analyzer/Cargo.lock

Lines changed: 33 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -788,6 +788,7 @@ dependencies = [
788788
"itertools 0.14.0",
789789
"ra-ap-rustc_type_ir",
790790
"rustc-hash 2.1.1",
791+
"serde_json",
791792
"smallvec",
792793
"span",
793794
"stdx",
@@ -901,6 +902,8 @@ dependencies = [
901902
"rustc_apfloat",
902903
"salsa",
903904
"salsa-macros",
905+
"serde",
906+
"serde_derive",
904907
"smallvec",
905908
"span",
906909
"stdx",
@@ -1214,7 +1217,9 @@ version = "0.0.0"
12141217
dependencies = [
12151218
"dashmap",
12161219
"hashbrown 0.14.5",
1220+
"rayon",
12171221
"rustc-hash 2.1.1",
1222+
"smallvec",
12181223
"triomphe",
12191224
]
12201225

@@ -2040,9 +2045,9 @@ checksum = "69cdb34c158ceb288df11e18b4bd39de994f6657d83847bdffdbd7f346754b0f"
20402045

20412046
[[package]]
20422047
name = "ra-ap-rustc_abi"
2043-
version = "0.139.0"
2048+
version = "0.143.0"
20442049
source = "registry+https://github.com/rust-lang/crates.io-index"
2045-
checksum = "ce480c45c05462cf6b700468118201b00132613a968a1849da5f7a555c0f1db9"
2050+
checksum = "1d49dbe5d570793b3c3227972a6ac85fc3e830f09b32c3cb3b68cfceebad3b0a"
20462051
dependencies = [
20472052
"bitflags 2.9.4",
20482053
"ra-ap-rustc_hashes",
@@ -2052,34 +2057,33 @@ dependencies = [
20522057

20532058
[[package]]
20542059
name = "ra-ap-rustc_ast_ir"
2055-
version = "0.139.0"
2060+
version = "0.143.0"
20562061
source = "registry+https://github.com/rust-lang/crates.io-index"
2057-
checksum = "453da2376de406d740ca28412a31ae3d5a6039cd45698c1c2fb01b577dff64ae"
2062+
checksum = "cd0956db62c264a899d15667993cbbd2e8f0b02108712217e2579c61ac30b94b"
20582063

20592064
[[package]]
20602065
name = "ra-ap-rustc_hashes"
2061-
version = "0.139.0"
2066+
version = "0.143.0"
20622067
source = "registry+https://github.com/rust-lang/crates.io-index"
2063-
checksum = "bf411a55deaa3ea348594c8273fb2d1200265bf87b881b40c62b32f75caf8323"
2068+
checksum = "7df512084c24f4c96c8cc9a59cbd264301efbc8913d3759b065398024af316c9"
20642069
dependencies = [
20652070
"rustc-stable-hash",
20662071
]
20672072

20682073
[[package]]
20692074
name = "ra-ap-rustc_index"
2070-
version = "0.139.0"
2075+
version = "0.143.0"
20712076
source = "registry+https://github.com/rust-lang/crates.io-index"
2072-
checksum = "1d0dd4cf1417ea8a809e9e7bf296c6ce6e05b75b043483872d1bd2951a08142c"
2077+
checksum = "bca3a49a928d38ba7927605e5909b6abe77d09ff359e4695c070c3f91d69cc8a"
20732078
dependencies = [
20742079
"ra-ap-rustc_index_macros",
2075-
"smallvec",
20762080
]
20772081

20782082
[[package]]
20792083
name = "ra-ap-rustc_index_macros"
2080-
version = "0.139.0"
2084+
version = "0.143.0"
20812085
source = "registry+https://github.com/rust-lang/crates.io-index"
2082-
checksum = "a1b0d218fb91f8969716a962142c722d88b3cd3fd1f7ef03093261bf37e85dfd"
2086+
checksum = "4463e908a62c64c2a65c1966c2f4995d0e1f8b7dfc85a8b8de2562edf3d89070"
20832087
dependencies = [
20842088
"proc-macro2",
20852089
"quote",
@@ -2088,9 +2092,9 @@ dependencies = [
20882092

20892093
[[package]]
20902094
name = "ra-ap-rustc_lexer"
2091-
version = "0.139.0"
2095+
version = "0.143.0"
20922096
source = "registry+https://github.com/rust-lang/crates.io-index"
2093-
checksum = "5ec7c26e92c44d5433b29cf661faf0027e263b70a411d0f28996bd67e3bdb57e"
2097+
checksum = "228e01e1b237adb4bd8793487e1c37019c1e526a8f93716d99602301be267056"
20942098
dependencies = [
20952099
"memchr",
20962100
"unicode-properties",
@@ -2099,9 +2103,9 @@ dependencies = [
20992103

21002104
[[package]]
21012105
name = "ra-ap-rustc_next_trait_solver"
2102-
version = "0.139.0"
2106+
version = "0.143.0"
21032107
source = "registry+https://github.com/rust-lang/crates.io-index"
2104-
checksum = "029686fdbc8a058cf3d81ad157e1cdc81a37b9de0400289ccb86a62465484313"
2108+
checksum = "10d6f91143011d474bb844d268b0784c6a4c6db57743558b83f5ad34511627f1"
21052109
dependencies = [
21062110
"derive-where",
21072111
"ra-ap-rustc_index",
@@ -2112,19 +2116,19 @@ dependencies = [
21122116

21132117
[[package]]
21142118
name = "ra-ap-rustc_parse_format"
2115-
version = "0.139.0"
2119+
version = "0.143.0"
21162120
source = "registry+https://github.com/rust-lang/crates.io-index"
2117-
checksum = "509d279f1e87acc33476da3fbd05a6054e9ffeb4427cb38ba01b9d2656aec268"
2121+
checksum = "37fa8effbc436c0ddd9d7b1421aa3cccf8b94566c841c4e4aa3e09063b8f423f"
21182122
dependencies = [
21192123
"ra-ap-rustc_lexer",
21202124
"rustc-literal-escaper 0.0.5",
21212125
]
21222126

21232127
[[package]]
21242128
name = "ra-ap-rustc_pattern_analysis"
2125-
version = "0.139.0"
2129+
version = "0.143.0"
21262130
source = "registry+https://github.com/rust-lang/crates.io-index"
2127-
checksum = "9bb2c9930854314b03bd7aab060a14bca6f194b76381a4c309e3905ec3a02bbc"
2131+
checksum = "883c843fc27847ad03b8e772dd4a2d2728af4333a6d6821a22dfcfe7136dff3e"
21282132
dependencies = [
21292133
"ra-ap-rustc_index",
21302134
"rustc-hash 2.1.1",
@@ -2135,9 +2139,9 @@ dependencies = [
21352139

21362140
[[package]]
21372141
name = "ra-ap-rustc_type_ir"
2138-
version = "0.139.0"
2142+
version = "0.143.0"
21392143
source = "registry+https://github.com/rust-lang/crates.io-index"
2140-
checksum = "0e4a92a3e4dbdebb0d4c9caceb52eff45c4df784d21fb2da90dac50e218f95c0"
2144+
checksum = "a86e33c46b2b261a173b23f207461a514812a8b2d2d7935bbc685f733eacce10"
21412145
dependencies = [
21422146
"arrayvec",
21432147
"bitflags 2.9.4",
@@ -2155,9 +2159,9 @@ dependencies = [
21552159

21562160
[[package]]
21572161
name = "ra-ap-rustc_type_ir_macros"
2158-
version = "0.139.0"
2162+
version = "0.143.0"
21592163
source = "registry+https://github.com/rust-lang/crates.io-index"
2160-
checksum = "ca368eca2472367f2e6fdfb431c8342e99d848e4ce89cb20dd3b3bdcc43cbc28"
2164+
checksum = "15034c2fcaa5cf302aea6db20eda0f71fffeb0b372d6073cc50f940e974a2a47"
21612165
dependencies = [
21622166
"proc-macro2",
21632167
"quote",
@@ -2445,9 +2449,9 @@ checksum = "28d3b2b1366ec20994f1fd18c3c594f05c5dd4bc44d8bb0c1c632c8d6829481f"
24452449

24462450
[[package]]
24472451
name = "salsa"
2448-
version = "0.24.0"
2452+
version = "0.25.2"
24492453
source = "registry+https://github.com/rust-lang/crates.io-index"
2450-
checksum = "27956164373aeec733ac24ff1736de8541234e3a8e7e6f916b28175b5752af3b"
2454+
checksum = "e2e2aa2fca57727371eeafc975acc8e6f4c52f8166a78035543f6ee1c74c2dcc"
24512455
dependencies = [
24522456
"boxcar",
24532457
"crossbeam-queue",
@@ -2470,15 +2474,15 @@ dependencies = [
24702474

24712475
[[package]]
24722476
name = "salsa-macro-rules"
2473-
version = "0.24.0"
2477+
version = "0.25.2"
24742478
source = "registry+https://github.com/rust-lang/crates.io-index"
2475-
checksum = "6ca3b9d6e47c08b5de4b218e0c5f7ec910b51bce6314e651c8e7b9d154d174da"
2479+
checksum = "1bfc2a1e7bf06964105515451d728f2422dedc3a112383324a00b191a5c397a3"
24762480

24772481
[[package]]
24782482
name = "salsa-macros"
2479-
version = "0.24.0"
2483+
version = "0.25.2"
24802484
source = "registry+https://github.com/rust-lang/crates.io-index"
2481-
checksum = "6337b62f2968be6b8afa30017d7564ecbde6832ada47ed2261fb14d0fd402ff4"
2485+
checksum = "3d844c1aa34946da46af683b5c27ec1088a3d9d84a2b837a108223fd830220e1"
24822486
dependencies = [
24832487
"proc-macro2",
24842488
"quote",

src/tools/rust-analyzer/Cargo.toml

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -86,14 +86,14 @@ vfs-notify = { path = "./crates/vfs-notify", version = "0.0.0" }
8686
vfs = { path = "./crates/vfs", version = "0.0.0" }
8787
edition = { path = "./crates/edition", version = "0.0.0" }
8888

89-
ra-ap-rustc_lexer = { version = "0.139", default-features = false }
90-
ra-ap-rustc_parse_format = { version = "0.139", default-features = false }
91-
ra-ap-rustc_index = { version = "0.139", default-features = false }
92-
ra-ap-rustc_abi = { version = "0.139", default-features = false }
93-
ra-ap-rustc_pattern_analysis = { version = "0.139", default-features = false }
94-
ra-ap-rustc_ast_ir = { version = "0.139", default-features = false }
95-
ra-ap-rustc_type_ir = { version = "0.139", default-features = false }
96-
ra-ap-rustc_next_trait_solver = { version = "0.139", default-features = false }
89+
ra-ap-rustc_lexer = { version = "0.143", default-features = false }
90+
ra-ap-rustc_parse_format = { version = "0.143", default-features = false }
91+
ra-ap-rustc_index = { version = "0.143", default-features = false }
92+
ra-ap-rustc_abi = { version = "0.143", default-features = false }
93+
ra-ap-rustc_pattern_analysis = { version = "0.143", default-features = false }
94+
ra-ap-rustc_ast_ir = { version = "0.143", default-features = false }
95+
ra-ap-rustc_type_ir = { version = "0.143", default-features = false }
96+
ra-ap-rustc_next_trait_solver = { version = "0.143", default-features = false }
9797

9898
# local crates that aren't published to crates.io. These should not have versions.
9999

@@ -135,13 +135,13 @@ rayon = "1.10.0"
135135
rowan = "=0.15.17"
136136
# Ideally we'd not enable the macros feature but unfortunately the `tracked` attribute does not work
137137
# on impls without it
138-
salsa = { version = "0.24.0", default-features = false, features = [
138+
salsa = { version = "0.25.2", default-features = false, features = [
139139
"rayon",
140140
"salsa_unstable",
141141
"macros",
142142
"inventory",
143143
] }
144-
salsa-macros = "0.24.0"
144+
salsa-macros = "0.25.2"
145145
semver = "1.0.26"
146146
serde = { version = "1.0.219" }
147147
serde_derive = { version = "1.0.219" }

src/tools/rust-analyzer/crates/base-db/src/input.rs

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -351,6 +351,8 @@ pub struct CrateData<Id> {
351351
/// declared in source via `extern crate test`.
352352
pub dependencies: Vec<Dependency<Id>>,
353353
pub origin: CrateOrigin,
354+
/// Extra crate-level attributes, including the surrounding `#![]`.
355+
pub crate_attrs: Box<[Box<str>]>,
354356
pub is_proc_macro: bool,
355357
/// The working directory to run proc-macros in invoked in the context of this crate.
356358
/// This is the workspace root of the cargo workspace for workspace members, the crate manifest
@@ -465,7 +467,7 @@ impl Crate {
465467
/// including the crate itself.
466468
///
467469
/// **Warning**: do not use this query in `hir-*` crates! It kills incrementality across crate metadata modifications.
468-
pub fn transitive_deps(self, db: &dyn salsa::Database) -> Box<[Crate]> {
470+
pub fn transitive_deps(self, db: &dyn salsa::Database) -> Vec<Crate> {
469471
// There is a bit of duplication here and in `CrateGraphBuilder` in the same method, but it's not terrible
470472
// and removing that is a bit difficult.
471473
let mut worklist = vec![self];
@@ -480,7 +482,7 @@ impl Crate {
480482

481483
worklist.extend(krate.data(db).dependencies.iter().map(|dep| dep.crate_id));
482484
}
483-
deps.into_boxed_slice()
485+
deps
484486
}
485487

486488
/// Returns all transitive reverse dependencies of the given crate,
@@ -530,6 +532,7 @@ impl CrateGraphBuilder {
530532
mut potential_cfg_options: Option<CfgOptions>,
531533
mut env: Env,
532534
origin: CrateOrigin,
535+
crate_attrs: Vec<String>,
533536
is_proc_macro: bool,
534537
proc_macro_cwd: Arc<AbsPathBuf>,
535538
ws_data: Arc<CrateWorkspaceData>,
@@ -539,12 +542,17 @@ impl CrateGraphBuilder {
539542
if let Some(potential_cfg_options) = &mut potential_cfg_options {
540543
potential_cfg_options.shrink_to_fit();
541544
}
545+
let crate_attrs: Vec<_> = crate_attrs
546+
.into_iter()
547+
.map(|raw_attr| format!("#![{raw_attr}]").into_boxed_str())
548+
.collect();
542549
self.arena.alloc(CrateBuilder {
543550
basic: CrateData {
544551
root_file_id,
545552
edition,
546553
dependencies: Vec::new(),
547554
origin,
555+
crate_attrs: crate_attrs.into_boxed_slice(),
548556
is_proc_macro,
549557
proc_macro_cwd,
550558
},
@@ -648,6 +656,7 @@ impl CrateGraphBuilder {
648656
edition: krate.basic.edition,
649657
is_proc_macro: krate.basic.is_proc_macro,
650658
origin: krate.basic.origin.clone(),
659+
crate_attrs: krate.basic.crate_attrs.clone(),
651660
root_file_id: krate.basic.root_file_id,
652661
proc_macro_cwd: krate.basic.proc_macro_cwd.clone(),
653662
};
@@ -975,6 +984,7 @@ mod tests {
975984
Default::default(),
976985
Env::default(),
977986
CrateOrigin::Local { repo: None, name: None },
987+
Vec::new(),
978988
false,
979989
Arc::new(AbsPathBuf::assert_utf8(std::env::current_dir().unwrap())),
980990
empty_ws_data(),
@@ -988,6 +998,7 @@ mod tests {
988998
Default::default(),
989999
Env::default(),
9901000
CrateOrigin::Local { repo: None, name: None },
1001+
Vec::new(),
9911002
false,
9921003
Arc::new(AbsPathBuf::assert_utf8(std::env::current_dir().unwrap())),
9931004
empty_ws_data(),
@@ -1001,6 +1012,7 @@ mod tests {
10011012
Default::default(),
10021013
Env::default(),
10031014
CrateOrigin::Local { repo: None, name: None },
1015+
Vec::new(),
10041016
false,
10051017
Arc::new(AbsPathBuf::assert_utf8(std::env::current_dir().unwrap())),
10061018
empty_ws_data(),
@@ -1034,6 +1046,7 @@ mod tests {
10341046
Default::default(),
10351047
Env::default(),
10361048
CrateOrigin::Local { repo: None, name: None },
1049+
Vec::new(),
10371050
false,
10381051
Arc::new(AbsPathBuf::assert_utf8(std::env::current_dir().unwrap())),
10391052
empty_ws_data(),
@@ -1047,6 +1060,7 @@ mod tests {
10471060
Default::default(),
10481061
Env::default(),
10491062
CrateOrigin::Local { repo: None, name: None },
1063+
Vec::new(),
10501064
false,
10511065
Arc::new(AbsPathBuf::assert_utf8(std::env::current_dir().unwrap())),
10521066
empty_ws_data(),
@@ -1075,6 +1089,7 @@ mod tests {
10751089
Default::default(),
10761090
Env::default(),
10771091
CrateOrigin::Local { repo: None, name: None },
1092+
Vec::new(),
10781093
false,
10791094
Arc::new(AbsPathBuf::assert_utf8(std::env::current_dir().unwrap())),
10801095
empty_ws_data(),
@@ -1088,6 +1103,7 @@ mod tests {
10881103
Default::default(),
10891104
Env::default(),
10901105
CrateOrigin::Local { repo: None, name: None },
1106+
Vec::new(),
10911107
false,
10921108
Arc::new(AbsPathBuf::assert_utf8(std::env::current_dir().unwrap())),
10931109
empty_ws_data(),
@@ -1101,6 +1117,7 @@ mod tests {
11011117
Default::default(),
11021118
Env::default(),
11031119
CrateOrigin::Local { repo: None, name: None },
1120+
Vec::new(),
11041121
false,
11051122
Arc::new(AbsPathBuf::assert_utf8(std::env::current_dir().unwrap())),
11061123
empty_ws_data(),
@@ -1129,6 +1146,7 @@ mod tests {
11291146
Default::default(),
11301147
Env::default(),
11311148
CrateOrigin::Local { repo: None, name: None },
1149+
Vec::new(),
11321150
false,
11331151
Arc::new(AbsPathBuf::assert_utf8(std::env::current_dir().unwrap())),
11341152
empty_ws_data(),
@@ -1142,6 +1160,7 @@ mod tests {
11421160
Default::default(),
11431161
Env::default(),
11441162
CrateOrigin::Local { repo: None, name: None },
1163+
Vec::new(),
11451164
false,
11461165
Arc::new(AbsPathBuf::assert_utf8(std::env::current_dir().unwrap())),
11471166
empty_ws_data(),

0 commit comments

Comments
 (0)