@@ -467,13 +467,11 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> {
467
467
468
468
pub ( crate ) fn lint_if_path_starts_with_module (
469
469
& mut self ,
470
- finalize : Option < Finalize > ,
470
+ finalize : Finalize ,
471
471
path : & [ Segment ] ,
472
472
second_binding : Option < NameBinding < ' _ > > ,
473
473
) {
474
- let Some ( Finalize { node_id, root_span, .. } ) = finalize else {
475
- return ;
476
- } ;
474
+ let Finalize { node_id, root_span, .. } = finalize;
477
475
478
476
let first_name = match path. get ( 0 ) {
479
477
// In the 2018 edition this lint is a hard error, so nothing to do
@@ -1027,7 +1025,7 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> {
1027
1025
) -> Option < TypoSuggestion > {
1028
1026
let mut suggestions = Vec :: new ( ) ;
1029
1027
let ctxt = ident. span . ctxt ( ) ;
1030
- self . visit_scopes ( scope_set, parent_scope, ctxt, |this, scope, use_prelude, _| {
1028
+ self . cm ( ) . visit_scopes ( scope_set, parent_scope, ctxt, |this, scope, use_prelude, _| {
1031
1029
match scope {
1032
1030
Scope :: DeriveHelpers ( expn_id) => {
1033
1031
let res = Res :: NonMacroAttr ( NonMacroAttrKind :: DeriveHelper ) ;
@@ -1046,7 +1044,7 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> {
1046
1044
if filter_fn ( res) {
1047
1045
for derive in parent_scope. derives {
1048
1046
let parent_scope = & ParentScope { derives : & [ ] , ..* parent_scope } ;
1049
- let Ok ( ( Some ( ext) , _) ) = this. resolve_macro_path (
1047
+ let Ok ( ( Some ( ext) , _) ) = this. reborrow ( ) . resolve_macro_path (
1050
1048
derive,
1051
1049
Some ( MacroKind :: Derive ) ,
1052
1050
parent_scope,
@@ -1480,7 +1478,7 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> {
1480
1478
) {
1481
1479
// Bring imported but unused `derive` macros into `macro_map` so we ensure they can be used
1482
1480
// for suggestions.
1483
- self . visit_scopes (
1481
+ self . cm ( ) . visit_scopes (
1484
1482
ScopeSet :: Macro ( MacroKind :: Derive ) ,
1485
1483
& parent_scope,
1486
1484
ident. span . ctxt ( ) ,
@@ -1589,7 +1587,7 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> {
1589
1587
} ) ;
1590
1588
}
1591
1589
for ns in [ Namespace :: MacroNS , Namespace :: TypeNS , Namespace :: ValueNS ] {
1592
- let Ok ( binding) = self . early_resolve_ident_in_lexical_scope (
1590
+ let Ok ( binding) = self . cm ( ) . early_resolve_ident_in_lexical_scope (
1593
1591
ident,
1594
1592
ScopeSet :: All ( ns) ,
1595
1593
parent_scope,
@@ -2269,16 +2267,17 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> {
2269
2267
if ns == TypeNS || ns == ValueNS {
2270
2268
let ns_to_try = if ns == TypeNS { ValueNS } else { TypeNS } ;
2271
2269
let binding = if let Some ( module) = module {
2272
- self . resolve_ident_in_module (
2273
- module,
2274
- ident,
2275
- ns_to_try,
2276
- parent_scope,
2277
- None ,
2278
- ignore_binding,
2279
- ignore_import,
2280
- )
2281
- . ok ( )
2270
+ self . cm ( )
2271
+ . resolve_ident_in_module (
2272
+ module,
2273
+ ident,
2274
+ ns_to_try,
2275
+ parent_scope,
2276
+ None ,
2277
+ ignore_binding,
2278
+ ignore_import,
2279
+ )
2280
+ . ok ( )
2282
2281
} else if let Some ( ribs) = ribs
2283
2282
&& let Some ( TypeNS | ValueNS ) = opt_ns
2284
2283
{
@@ -2296,16 +2295,17 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> {
2296
2295
_ => None ,
2297
2296
}
2298
2297
} else {
2299
- self . early_resolve_ident_in_lexical_scope (
2300
- ident,
2301
- ScopeSet :: All ( ns_to_try) ,
2302
- parent_scope,
2303
- None ,
2304
- false ,
2305
- ignore_binding,
2306
- ignore_import,
2307
- )
2308
- . ok ( )
2298
+ self . cm ( )
2299
+ . early_resolve_ident_in_lexical_scope (
2300
+ ident,
2301
+ ScopeSet :: All ( ns_to_try) ,
2302
+ parent_scope,
2303
+ None ,
2304
+ false ,
2305
+ ignore_binding,
2306
+ ignore_import,
2307
+ )
2308
+ . ok ( )
2309
2309
} ;
2310
2310
if let Some ( binding) = binding {
2311
2311
msg = format ! (
@@ -2399,7 +2399,7 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> {
2399
2399
} ,
2400
2400
)
2401
2401
} ) ;
2402
- if let Ok ( binding) = self . early_resolve_ident_in_lexical_scope (
2402
+ if let Ok ( binding) = self . cm ( ) . early_resolve_ident_in_lexical_scope (
2403
2403
ident,
2404
2404
ScopeSet :: All ( ValueNS ) ,
2405
2405
parent_scope,
@@ -2529,7 +2529,7 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> {
2529
2529
) -> Option < ( Vec < Segment > , Option < String > ) > {
2530
2530
// Replace first ident with `self` and check if that is valid.
2531
2531
path[ 0 ] . ident . name = kw:: SelfLower ;
2532
- let result = self . maybe_resolve_path ( & path, None , parent_scope, None ) ;
2532
+ let result = self . cm ( ) . maybe_resolve_path ( & path, None , parent_scope, None ) ;
2533
2533
debug ! ( ?path, ?result) ;
2534
2534
if let PathResult :: Module ( ..) = result { Some ( ( path, None ) ) } else { None }
2535
2535
}
@@ -2549,7 +2549,7 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> {
2549
2549
) -> Option < ( Vec < Segment > , Option < String > ) > {
2550
2550
// Replace first ident with `crate` and check if that is valid.
2551
2551
path[ 0 ] . ident . name = kw:: Crate ;
2552
- let result = self . maybe_resolve_path ( & path, None , parent_scope, None ) ;
2552
+ let result = self . cm ( ) . maybe_resolve_path ( & path, None , parent_scope, None ) ;
2553
2553
debug ! ( ?path, ?result) ;
2554
2554
if let PathResult :: Module ( ..) = result {
2555
2555
Some ( (
@@ -2581,7 +2581,7 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> {
2581
2581
) -> Option < ( Vec < Segment > , Option < String > ) > {
2582
2582
// Replace first ident with `crate` and check if that is valid.
2583
2583
path[ 0 ] . ident . name = kw:: Super ;
2584
- let result = self . maybe_resolve_path ( & path, None , parent_scope, None ) ;
2584
+ let result = self . cm ( ) . maybe_resolve_path ( & path, None , parent_scope, None ) ;
2585
2585
debug ! ( ?path, ?result) ;
2586
2586
if let PathResult :: Module ( ..) = result { Some ( ( path, None ) ) } else { None }
2587
2587
}
@@ -2616,7 +2616,7 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> {
2616
2616
for name in extern_crate_names. into_iter ( ) {
2617
2617
// Replace first ident with a crate name and check if that is valid.
2618
2618
path[ 0 ] . ident . name = name;
2619
- let result = self . maybe_resolve_path ( & path, None , parent_scope, None ) ;
2619
+ let result = self . cm ( ) . maybe_resolve_path ( & path, None , parent_scope, None ) ;
2620
2620
debug ! ( ?path, ?name, ?result) ;
2621
2621
if let PathResult :: Module ( ..) = result {
2622
2622
return Some ( ( path, None ) ) ;
0 commit comments