@@ -469,13 +469,11 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> {
469
469
470
470
pub ( crate ) fn lint_if_path_starts_with_module (
471
471
& mut self ,
472
- finalize : Option < Finalize > ,
472
+ finalize : Finalize ,
473
473
path : & [ Segment ] ,
474
474
second_binding : Option < NameBinding < ' _ > > ,
475
475
) {
476
- let Some ( Finalize { node_id, root_span, .. } ) = finalize else {
477
- return ;
478
- } ;
476
+ let Finalize { node_id, root_span, .. } = finalize;
479
477
480
478
let first_name = match path. get ( 0 ) {
481
479
// In the 2018 edition this lint is a hard error, so nothing to do
@@ -1029,7 +1027,7 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> {
1029
1027
) -> Option < TypoSuggestion > {
1030
1028
let mut suggestions = Vec :: new ( ) ;
1031
1029
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, _| {
1033
1031
match scope {
1034
1032
Scope :: DeriveHelpers ( expn_id) => {
1035
1033
let res = Res :: NonMacroAttr ( NonMacroAttrKind :: DeriveHelper ) ;
@@ -1048,7 +1046,7 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> {
1048
1046
if filter_fn ( res) {
1049
1047
for derive in parent_scope. derives {
1050
1048
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 (
1052
1050
derive,
1053
1051
Some ( MacroKind :: Derive ) ,
1054
1052
parent_scope,
@@ -1482,7 +1480,7 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> {
1482
1480
) {
1483
1481
// Bring imported but unused `derive` macros into `macro_map` so we ensure they can be used
1484
1482
// for suggestions.
1485
- self . visit_scopes (
1483
+ self . cm ( ) . visit_scopes (
1486
1484
ScopeSet :: Macro ( MacroKind :: Derive ) ,
1487
1485
& parent_scope,
1488
1486
ident. span . ctxt ( ) ,
@@ -1591,7 +1589,7 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> {
1591
1589
} ) ;
1592
1590
}
1593
1591
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 (
1595
1593
ident,
1596
1594
ScopeSet :: All ( ns) ,
1597
1595
parent_scope,
@@ -2271,16 +2269,17 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> {
2271
2269
if ns == TypeNS || ns == ValueNS {
2272
2270
let ns_to_try = if ns == TypeNS { ValueNS } else { TypeNS } ;
2273
2271
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 ( )
2284
2283
} else if let Some ( ribs) = ribs
2285
2284
&& let Some ( TypeNS | ValueNS ) = opt_ns
2286
2285
{
@@ -2298,16 +2297,17 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> {
2298
2297
_ => None ,
2299
2298
}
2300
2299
} 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 ( )
2311
2311
} ;
2312
2312
if let Some ( binding) = binding {
2313
2313
msg = format ! (
@@ -2401,7 +2401,7 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> {
2401
2401
} ,
2402
2402
)
2403
2403
} ) ;
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 (
2405
2405
ident,
2406
2406
ScopeSet :: All ( ValueNS ) ,
2407
2407
parent_scope,
@@ -2531,7 +2531,7 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> {
2531
2531
) -> Option < ( Vec < Segment > , Option < String > ) > {
2532
2532
// Replace first ident with `self` and check if that is valid.
2533
2533
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 ) ;
2535
2535
debug ! ( ?path, ?result) ;
2536
2536
if let PathResult :: Module ( ..) = result { Some ( ( path, None ) ) } else { None }
2537
2537
}
@@ -2551,7 +2551,7 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> {
2551
2551
) -> Option < ( Vec < Segment > , Option < String > ) > {
2552
2552
// Replace first ident with `crate` and check if that is valid.
2553
2553
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 ) ;
2555
2555
debug ! ( ?path, ?result) ;
2556
2556
if let PathResult :: Module ( ..) = result {
2557
2557
Some ( (
@@ -2583,7 +2583,7 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> {
2583
2583
) -> Option < ( Vec < Segment > , Option < String > ) > {
2584
2584
// Replace first ident with `crate` and check if that is valid.
2585
2585
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 ) ;
2587
2587
debug ! ( ?path, ?result) ;
2588
2588
if let PathResult :: Module ( ..) = result { Some ( ( path, None ) ) } else { None }
2589
2589
}
@@ -2618,7 +2618,7 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> {
2618
2618
for name in extern_crate_names. into_iter ( ) {
2619
2619
// Replace first ident with a crate name and check if that is valid.
2620
2620
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 ) ;
2622
2622
debug ! ( ?path, ?name, ?result) ;
2623
2623
if let PathResult :: Module ( ..) = result {
2624
2624
return Some ( ( path, None ) ) ;
0 commit comments