@@ -469,13 +469,11 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> {
469469
470470 pub ( crate ) fn lint_if_path_starts_with_module (
471471 & mut self ,
472- finalize : Option < Finalize > ,
472+ finalize : Finalize ,
473473 path : & [ Segment ] ,
474474 second_binding : Option < NameBinding < ' _ > > ,
475475 ) {
476- let Some ( Finalize { node_id, root_span, .. } ) = finalize else {
477- return ;
478- } ;
476+ let Finalize { node_id, root_span, .. } = finalize;
479477
480478 let first_name = match path. get ( 0 ) {
481479 // In the 2018 edition this lint is a hard error, so nothing to do
@@ -1029,7 +1027,7 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> {
10291027 ) -> Option < TypoSuggestion > {
10301028 let mut suggestions = Vec :: new ( ) ;
10311029 let ctxt = ident. span . ctxt ( ) ;
1032- self . visit_scopes ( scope_set, parent_scope, ctxt, |this, scope, use_prelude, _| {
1030+ self . cm ( ) . visit_scopes ( scope_set, parent_scope, ctxt, |this, scope, use_prelude, _| {
10331031 match scope {
10341032 Scope :: DeriveHelpers ( expn_id) => {
10351033 let res = Res :: NonMacroAttr ( NonMacroAttrKind :: DeriveHelper ) ;
@@ -1048,7 +1046,7 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> {
10481046 if filter_fn ( res) {
10491047 for derive in parent_scope. derives {
10501048 let parent_scope = & ParentScope { derives : & [ ] , ..* parent_scope } ;
1051- let Ok ( ( Some ( ext) , _) ) = this. resolve_macro_path (
1049+ let Ok ( ( Some ( ext) , _) ) = this. reborrow ( ) . resolve_macro_path (
10521050 derive,
10531051 Some ( MacroKind :: Derive ) ,
10541052 parent_scope,
@@ -1482,7 +1480,7 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> {
14821480 ) {
14831481 // Bring imported but unused `derive` macros into `macro_map` so we ensure they can be used
14841482 // for suggestions.
1485- self . visit_scopes (
1483+ self . cm ( ) . visit_scopes (
14861484 ScopeSet :: Macro ( MacroKind :: Derive ) ,
14871485 & parent_scope,
14881486 ident. span . ctxt ( ) ,
@@ -1591,7 +1589,7 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> {
15911589 } ) ;
15921590 }
15931591 for ns in [ Namespace :: MacroNS , Namespace :: TypeNS , Namespace :: ValueNS ] {
1594- let Ok ( binding) = self . early_resolve_ident_in_lexical_scope (
1592+ let Ok ( binding) = self . cm ( ) . early_resolve_ident_in_lexical_scope (
15951593 ident,
15961594 ScopeSet :: All ( ns) ,
15971595 parent_scope,
@@ -2271,16 +2269,17 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> {
22712269 if ns == TypeNS || ns == ValueNS {
22722270 let ns_to_try = if ns == TypeNS { ValueNS } else { TypeNS } ;
22732271 let binding = if let Some ( module) = module {
2274- self . resolve_ident_in_module (
2275- module,
2276- ident,
2277- ns_to_try,
2278- parent_scope,
2279- None ,
2280- ignore_binding,
2281- ignore_import,
2282- )
2283- . ok ( )
2272+ self . cm ( )
2273+ . resolve_ident_in_module (
2274+ module,
2275+ ident,
2276+ ns_to_try,
2277+ parent_scope,
2278+ None ,
2279+ ignore_binding,
2280+ ignore_import,
2281+ )
2282+ . ok ( )
22842283 } else if let Some ( ribs) = ribs
22852284 && let Some ( TypeNS | ValueNS ) = opt_ns
22862285 {
@@ -2298,16 +2297,17 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> {
22982297 _ => None ,
22992298 }
23002299 } else {
2301- self . early_resolve_ident_in_lexical_scope (
2302- ident,
2303- ScopeSet :: All ( ns_to_try) ,
2304- parent_scope,
2305- None ,
2306- false ,
2307- ignore_binding,
2308- ignore_import,
2309- )
2310- . ok ( )
2300+ self . cm ( )
2301+ . early_resolve_ident_in_lexical_scope (
2302+ ident,
2303+ ScopeSet :: All ( ns_to_try) ,
2304+ parent_scope,
2305+ None ,
2306+ false ,
2307+ ignore_binding,
2308+ ignore_import,
2309+ )
2310+ . ok ( )
23112311 } ;
23122312 if let Some ( binding) = binding {
23132313 msg = format ! (
@@ -2401,7 +2401,7 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> {
24012401 } ,
24022402 )
24032403 } ) ;
2404- if let Ok ( binding) = self . early_resolve_ident_in_lexical_scope (
2404+ if let Ok ( binding) = self . cm ( ) . early_resolve_ident_in_lexical_scope (
24052405 ident,
24062406 ScopeSet :: All ( ValueNS ) ,
24072407 parent_scope,
@@ -2531,7 +2531,7 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> {
25312531 ) -> Option < ( Vec < Segment > , Option < String > ) > {
25322532 // Replace first ident with `self` and check if that is valid.
25332533 path[ 0 ] . ident . name = kw:: SelfLower ;
2534- let result = self . maybe_resolve_path ( & path, None , parent_scope, None ) ;
2534+ let result = self . cm ( ) . maybe_resolve_path ( & path, None , parent_scope, None ) ;
25352535 debug ! ( ?path, ?result) ;
25362536 if let PathResult :: Module ( ..) = result { Some ( ( path, None ) ) } else { None }
25372537 }
@@ -2551,7 +2551,7 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> {
25512551 ) -> Option < ( Vec < Segment > , Option < String > ) > {
25522552 // Replace first ident with `crate` and check if that is valid.
25532553 path[ 0 ] . ident . name = kw:: Crate ;
2554- let result = self . maybe_resolve_path ( & path, None , parent_scope, None ) ;
2554+ let result = self . cm ( ) . maybe_resolve_path ( & path, None , parent_scope, None ) ;
25552555 debug ! ( ?path, ?result) ;
25562556 if let PathResult :: Module ( ..) = result {
25572557 Some ( (
@@ -2583,7 +2583,7 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> {
25832583 ) -> Option < ( Vec < Segment > , Option < String > ) > {
25842584 // Replace first ident with `crate` and check if that is valid.
25852585 path[ 0 ] . ident . name = kw:: Super ;
2586- let result = self . maybe_resolve_path ( & path, None , parent_scope, None ) ;
2586+ let result = self . cm ( ) . maybe_resolve_path ( & path, None , parent_scope, None ) ;
25872587 debug ! ( ?path, ?result) ;
25882588 if let PathResult :: Module ( ..) = result { Some ( ( path, None ) ) } else { None }
25892589 }
@@ -2618,7 +2618,7 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> {
26182618 for name in extern_crate_names. into_iter ( ) {
26192619 // Replace first ident with a crate name and check if that is valid.
26202620 path[ 0 ] . ident . name = name;
2621- let result = self . maybe_resolve_path ( & path, None , parent_scope, None ) ;
2621+ let result = self . cm ( ) . maybe_resolve_path ( & path, None , parent_scope, None ) ;
26222622 debug ! ( ?path, ?name, ?result) ;
26232623 if let PathResult :: Module ( ..) = result {
26242624 return Some ( ( path, None ) ) ;
0 commit comments