diff options
| author | Matthias Krüger <476013+matthiaskrgr@users.noreply.github.com> | 2025-09-26 18:11:08 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-09-26 18:11:08 +0200 |
| commit | f104ae4252b1f508e5b4a8193954ab518091b2c0 (patch) | |
| tree | 7d3711f3df62c0e800519fbada2657038697ce1f /compiler/rustc_resolve/src | |
| parent | a8858111044a9391ac7558f969d3bf62ef43222d (diff) | |
| parent | f89660e4aa018401ca993f0df190e5f4c4a6799b (diff) | |
| download | rust-f104ae4252b1f508e5b4a8193954ab518091b2c0.tar.gz rust-f104ae4252b1f508e5b4a8193954ab518091b2c0.zip | |
Rollup merge of #145113 - petrochenkov:lessfinalize, r=lcnr
resolve: Do not finalize shadowed bindings I.e. do not mark them as used, or non-speculatively loaded, or similar. Previously they were sometimes finalized during early resolution, causing issues like https://github.com/rust-lang/rust/pull/144793#issuecomment-3168108005.
Diffstat (limited to 'compiler/rustc_resolve/src')
| -rw-r--r-- | compiler/rustc_resolve/src/ident.rs | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/compiler/rustc_resolve/src/ident.rs b/compiler/rustc_resolve/src/ident.rs index 35051675fd8..51489019950 100644 --- a/compiler/rustc_resolve/src/ident.rs +++ b/compiler/rustc_resolve/src/ident.rs @@ -492,14 +492,13 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> { _ => Err(Determinacy::Determined), }, Scope::Module(module, derive_fallback_lint_id) => { - // FIXME: use `finalize_scope` here. let (adjusted_parent_scope, adjusted_finalize) = if matches!(scope_set, ScopeSet::ModuleAndExternPrelude(..)) { - (parent_scope, finalize) + (parent_scope, finalize_scope!()) } else { ( &ParentScope { module, ..*parent_scope }, - finalize.map(|f| Finalize { used: Used::Scope, ..f }), + finalize_scope!().map(|f| Finalize { used: Used::Scope, ..f }), ) }; let binding = this.reborrow().resolve_ident_in_module_unadjusted( @@ -557,8 +556,10 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> { None => Err(Determinacy::Determined), }, Scope::ExternPreludeItems => { - // FIXME: use `finalize_scope` here. - match this.reborrow().extern_prelude_get_item(ident, finalize.is_some()) { + match this + .reborrow() + .extern_prelude_get_item(ident, finalize_scope!().is_some()) + { Some(binding) => { extern_prelude_item_binding = Some(binding); Ok((binding, Flags::empty())) |
