Skip to content

Commit 4357818

Browse files
authored
Unrolled build for #148187
Rollup merge of #148187 - LorrensP-2158466:cm-res-variance, r=petrochenkov Remove uses of `&mut CmResolver` Before #148329, using CmResolver in closures was not possible when trying to reborrow. This pr changes uses of `&mut CmResolver` into a bare `CmResolver`, to keep the code clean (and to not have `&mut &mut Resolver`) r? @petrochenkov
2 parents 4742769 + 97b0578 commit 4357818

File tree

3 files changed

+9
-9
lines changed

3 files changed

+9
-9
lines changed

compiler/rustc_resolve/src/ident.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> {
5858
orig_ctxt: Span,
5959
derive_fallback_lint_id: Option<NodeId>,
6060
mut visitor: impl FnMut(
61-
&mut CmResolver<'r, 'ra, 'tcx>,
61+
CmResolver<'_, 'ra, 'tcx>,
6262
Scope<'ra>,
6363
UsePrelude,
6464
Span,
@@ -165,7 +165,7 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> {
165165
if visit {
166166
let use_prelude = if use_prelude { UsePrelude::Yes } else { UsePrelude::No };
167167
if let ControlFlow::Break(break_result) =
168-
visitor(&mut self, scope, use_prelude, ctxt)
168+
visitor(self.reborrow(), scope, use_prelude, ctxt)
169169
{
170170
return Some(break_result);
171171
}
@@ -438,7 +438,7 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> {
438438
parent_scope,
439439
orig_ident.span,
440440
derive_fallback_lint_id,
441-
|this, scope, use_prelude, ctxt| {
441+
|mut this, scope, use_prelude, ctxt| {
442442
let ident = Ident::new(orig_ident.name, ctxt);
443443
// The passed `ctxt` is already normalized, so avoid expensive double normalization.
444444
let ident = Macros20NormalizedIdent(ident);

compiler/rustc_resolve/src/imports.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -893,7 +893,7 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> {
893893
};
894894

895895
let mut indeterminate_count = 0;
896-
self.per_ns_cm(|this, ns| {
896+
self.per_ns_cm(|mut this, ns| {
897897
if !type_ns_only || ns == TypeNS {
898898
if bindings[ns].get() != PendingDecl::Pending {
899899
return;

compiler/rustc_resolve/src/lib.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1831,13 +1831,13 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> {
18311831
f(self, MacroNS);
18321832
}
18331833

1834-
fn per_ns_cm<'r, F: FnMut(&mut CmResolver<'r, 'ra, 'tcx>, Namespace)>(
1834+
fn per_ns_cm<'r, F: FnMut(CmResolver<'_, 'ra, 'tcx>, Namespace)>(
18351835
mut self: CmResolver<'r, 'ra, 'tcx>,
18361836
mut f: F,
18371837
) {
1838-
f(&mut self, TypeNS);
1839-
f(&mut self, ValueNS);
1840-
f(&mut self, MacroNS);
1838+
f(self.reborrow(), TypeNS);
1839+
f(self.reborrow(), ValueNS);
1840+
f(self, MacroNS);
18411841
}
18421842

18431843
fn is_builtin_macro(&self, res: Res) -> bool {
@@ -1902,7 +1902,7 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> {
19021902
}
19031903

19041904
let scope_set = ScopeSet::All(TypeNS);
1905-
self.cm().visit_scopes(scope_set, parent_scope, ctxt, None, |this, scope, _, _| {
1905+
self.cm().visit_scopes(scope_set, parent_scope, ctxt, None, |mut this, scope, _, _| {
19061906
match scope {
19071907
Scope::ModuleNonGlobs(module, _) => {
19081908
this.get_mut().traits_in_module(module, assoc_item, &mut found_traits);

0 commit comments

Comments
 (0)