From 9e9e361bb53f219efef97fbbc0633c4e3dc0581f Mon Sep 17 00:00:00 2001 From: LorrensP-2158466 Date: Fri, 31 Oct 2025 15:19:32 +0100 Subject: [PATCH] use CmResolver instead of &mut CmResolver --- compiler/rustc_resolve/src/ident.rs | 7 ++++--- compiler/rustc_resolve/src/imports.rs | 2 +- compiler/rustc_resolve/src/lib.rs | 10 +++++----- 3 files changed, 10 insertions(+), 9 deletions(-) diff --git a/compiler/rustc_resolve/src/ident.rs b/compiler/rustc_resolve/src/ident.rs index 2a195c8068dac..d4b04b831011e 100644 --- a/compiler/rustc_resolve/src/ident.rs +++ b/compiler/rustc_resolve/src/ident.rs @@ -50,7 +50,7 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> { ctxt: SyntaxContext, derive_fallback_lint_id: Option, mut visitor: impl FnMut( - &mut CmResolver<'r, 'ra, 'tcx>, + CmResolver<'_, 'ra, 'tcx>, Scope<'ra>, UsePrelude, SyntaxContext, @@ -154,7 +154,8 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> { if visit { let use_prelude = if use_prelude { UsePrelude::Yes } else { UsePrelude::No }; - if let break_result @ Some(..) = visitor(&mut self, scope, use_prelude, ctxt) { + if let break_result @ Some(..) = visitor(self.reborrow(), scope, use_prelude, ctxt) + { return break_result; } } @@ -438,7 +439,7 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> { parent_scope, orig_ident.span.ctxt(), derive_fallback_lint_id, - |this, scope, use_prelude, ctxt| { + |mut this, scope, use_prelude, ctxt| { let ident = Ident::new(orig_ident.name, orig_ident.span.with_ctxt(ctxt)); let result = match scope { Scope::DeriveHelpers(expn_id) => { diff --git a/compiler/rustc_resolve/src/imports.rs b/compiler/rustc_resolve/src/imports.rs index f98aaecea18ce..cee58e61b4243 100644 --- a/compiler/rustc_resolve/src/imports.rs +++ b/compiler/rustc_resolve/src/imports.rs @@ -873,7 +873,7 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> { }; let mut indeterminate_count = 0; - self.per_ns_cm(|this, ns| { + self.per_ns_cm(|mut this, ns| { if !type_ns_only || ns == TypeNS { if bindings[ns].get() != PendingBinding::Pending { return; diff --git a/compiler/rustc_resolve/src/lib.rs b/compiler/rustc_resolve/src/lib.rs index 1636605b234f4..e5c0b9390a566 100644 --- a/compiler/rustc_resolve/src/lib.rs +++ b/compiler/rustc_resolve/src/lib.rs @@ -1835,13 +1835,13 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> { f(self, MacroNS); } - fn per_ns_cm<'r, F: FnMut(&mut CmResolver<'r, 'ra, 'tcx>, Namespace)>( + fn per_ns_cm<'r, F: FnMut(CmResolver<'_, 'ra, 'tcx>, Namespace)>( mut self: CmResolver<'r, 'ra, 'tcx>, mut f: F, ) { - f(&mut self, TypeNS); - f(&mut self, ValueNS); - f(&mut self, MacroNS); + f(self.reborrow(), TypeNS); + f(self.reborrow(), ValueNS); + f(self, MacroNS); } fn is_builtin_macro(&self, res: Res) -> bool { @@ -1898,7 +1898,7 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> { } let scope_set = ScopeSet::All(TypeNS); - self.cm().visit_scopes(scope_set, parent_scope, ctxt, None, |this, scope, _, _| { + self.cm().visit_scopes(scope_set, parent_scope, ctxt, None, |mut this, scope, _, _| { match scope { Scope::Module(module, _) => { this.get_mut().traits_in_module(module, assoc_item, &mut found_traits);