Skip to content

Commit 04813e4

Browse files
committed
Auto merge of #150277 - JonathanBrouwer:rollup-gvmdw36, r=JonathanBrouwer
Rollup of 4 pull requests Successful merges: - #150098 (remove `legacy_const_generic_args` cache) - #150155 (fix ICE when {{root}} appears in import suggestions) - #150267 (`rust-analyzer` subtree update) - #150274 (Fix typo) r? `@ghost` `@rustbot` modify labels: rollup
2 parents e1212ea + bfca3ee commit 04813e4

File tree

197 files changed

+7974
-4366
lines changed

Some content is hidden

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

197 files changed

+7974
-4366
lines changed

compiler/rustc_ast/src/ast.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1810,7 +1810,7 @@ pub enum ExprKind {
18101810
/// or a `gen` block (`gen move { ... }`).
18111811
///
18121812
/// The span is the "decl", which is the header before the body `{ }`
1813-
/// including the `asyng`/`gen` keywords and possibly `move`.
1813+
/// including the `async`/`gen` keywords and possibly `move`.
18141814
Gen(CaptureBy, Box<Block>, GenBlockKind, Span),
18151815
/// An await expression (`my_future.await`). Span is of await keyword.
18161816
Await(Box<Expr>, Span),

compiler/rustc_ast_lowering/src/expr.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,8 @@ impl<'hir> LoweringContext<'_, 'hir> {
114114
}
115115
ExprKind::Tup(elts) => hir::ExprKind::Tup(self.lower_exprs(elts)),
116116
ExprKind::Call(f, args) => {
117-
if let Some(legacy_args) = self.resolver.legacy_const_generic_args(f) {
117+
if let Some(legacy_args) = self.resolver.legacy_const_generic_args(f, self.tcx)
118+
{
118119
self.lower_legacy_const_generics((**f).clone(), args.clone(), &legacy_args)
119120
} else {
120121
let f = self.lower_expr(f);

compiler/rustc_ast_lowering/src/lib.rs

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -47,13 +47,14 @@ use rustc_data_structures::stable_hasher::{HashStable, StableHasher};
4747
use rustc_data_structures::sync::spawn;
4848
use rustc_data_structures::tagged_ptr::TaggedRef;
4949
use rustc_errors::{DiagArgFromDisplay, DiagCtxtHandle};
50+
use rustc_hir::attrs::AttributeKind;
5051
use rustc_hir::def::{DefKind, LifetimeRes, Namespace, PartialRes, PerNS, Res};
5152
use rustc_hir::def_id::{CRATE_DEF_ID, LOCAL_CRATE, LocalDefId};
5253
use rustc_hir::definitions::{DefPathData, DisambiguatorState};
5354
use rustc_hir::lints::DelayedLint;
5455
use rustc_hir::{
5556
self as hir, AngleBrackets, ConstArg, GenericArg, HirId, ItemLocalMap, LifetimeSource,
56-
LifetimeSyntax, ParamName, Target, TraitCandidate,
57+
LifetimeSyntax, ParamName, Target, TraitCandidate, find_attr,
5758
};
5859
use rustc_index::{Idx, IndexSlice, IndexVec};
5960
use rustc_macros::extension;
@@ -236,7 +237,7 @@ impl SpanLowerer {
236237

237238
#[extension(trait ResolverAstLoweringExt)]
238239
impl ResolverAstLowering {
239-
fn legacy_const_generic_args(&self, expr: &Expr) -> Option<Vec<usize>> {
240+
fn legacy_const_generic_args(&self, expr: &Expr, tcx: TyCtxt<'_>) -> Option<Vec<usize>> {
240241
let ExprKind::Path(None, path) = &expr.kind else {
241242
return None;
242243
};
@@ -256,11 +257,12 @@ impl ResolverAstLowering {
256257
return None;
257258
}
258259

259-
if let Some(v) = self.legacy_const_generic_args.get(&def_id) {
260-
return v.clone();
261-
}
262-
263-
None
260+
find_attr!(
261+
// we can use parsed attrs here since for other crates they're already available
262+
tcx.get_all_attrs(def_id),
263+
AttributeKind::RustcLegacyConstGenerics{fn_indexes,..} => fn_indexes
264+
)
265+
.map(|fn_indexes| fn_indexes.iter().map(|(num, _)| *num).collect())
264266
}
265267

266268
fn get_partial_res(&self, id: NodeId) -> Option<PartialRes> {

compiler/rustc_middle/src/ty/mod.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ use rustc_ast::AttrVec;
3131
use rustc_ast::expand::typetree::{FncTree, Kind, Type, TypeTree};
3232
use rustc_ast::node_id::NodeMap;
3333
pub use rustc_ast_ir::{Movability, Mutability, try_visit};
34-
use rustc_data_structures::fx::{FxHashMap, FxHashSet, FxIndexMap, FxIndexSet};
34+
use rustc_data_structures::fx::{FxHashSet, FxIndexMap, FxIndexSet};
3535
use rustc_data_structures::intern::Interned;
3636
use rustc_data_structures::stable_hasher::{HashStable, StableHasher};
3737
use rustc_data_structures::steal::Steal;
@@ -196,7 +196,6 @@ pub struct ResolverGlobalCtxt {
196196
/// This struct is meant to be consumed by lowering.
197197
#[derive(Debug)]
198198
pub struct ResolverAstLowering {
199-
pub legacy_const_generic_args: FxHashMap<DefId, Option<Vec<usize>>>,
200199
/// Resolutions for nodes that have a single resolution.
201200
pub partial_res_map: NodeMap<hir::def::PartialRes>,
202201
/// Resolutions for import nodes, which have multiple resolutions in different namespaces.

compiler/rustc_resolve/src/diagnostics.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2223,7 +2223,11 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> {
22232223
match binding.kind {
22242224
NameBindingKind::Import { import, .. } => {
22252225
for segment in import.module_path.iter().skip(1) {
2226-
path.push(segment.ident);
2226+
// Don't include `{{root}}` in suggestions - it's an internal symbol
2227+
// that should never be shown to users.
2228+
if segment.ident.name != kw::PathRoot {
2229+
path.push(segment.ident);
2230+
}
22272231
}
22282232
sugg_paths.push((
22292233
path.iter().cloned().chain(std::iter::once(ident)).collect::<Vec<_>>(),

compiler/rustc_resolve/src/lib.rs

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1271,7 +1271,6 @@ pub struct Resolver<'ra, 'tcx> {
12711271
/// and how the `impl Trait` fragments were introduced.
12721272
invocation_parents: FxHashMap<LocalExpnId, InvocationParent>,
12731273

1274-
legacy_const_generic_args: FxHashMap<DefId, Option<Vec<usize>>>,
12751274
/// Amount of lifetime parameters for each item in the crate.
12761275
item_generics_num_lifetimes: FxHashMap<LocalDefId, usize>,
12771276
delegation_fn_sigs: LocalDefIdMap<DelegationFnSig>,
@@ -1676,7 +1675,6 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> {
16761675
node_id_to_def_id,
16771676
disambiguator: DisambiguatorState::new(),
16781677
placeholder_field_indices: Default::default(),
1679-
legacy_const_generic_args: Default::default(),
16801678
invocation_parents,
16811679
item_generics_num_lifetimes: Default::default(),
16821680
trait_impls: Default::default(),
@@ -1807,7 +1805,6 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> {
18071805
stripped_cfg_items,
18081806
};
18091807
let ast_lowering = ty::ResolverAstLowering {
1810-
legacy_const_generic_args: self.legacy_const_generic_args,
18111808
partial_res_map: self.partial_res_map,
18121809
import_res_map: self.import_res_map,
18131810
label_res_map: self.label_res_map,
@@ -2416,15 +2413,12 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> {
24162413
return None;
24172414
}
24182415

2419-
let indexes = find_attr!(
2416+
find_attr!(
24202417
// we can use parsed attrs here since for other crates they're already available
24212418
self.tcx.get_all_attrs(def_id),
24222419
AttributeKind::RustcLegacyConstGenerics{fn_indexes,..} => fn_indexes
24232420
)
2424-
.map(|fn_indexes| fn_indexes.iter().map(|(num, _)| *num).collect());
2425-
2426-
self.legacy_const_generic_args.insert(def_id, indexes.clone());
2427-
indexes
2421+
.map(|fn_indexes| fn_indexes.iter().map(|(num, _)| *num).collect())
24282422
}
24292423

24302424
fn resolve_main(&mut self) {

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" }

0 commit comments

Comments
 (0)