@@ -1052,6 +1052,7 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
1052
1052
parent_scope,
1053
1053
false ,
1054
1054
false ,
1055
+ None ,
1055
1056
) {
1056
1057
suggestions. extend (
1057
1058
ext. helper_attrs
@@ -1506,6 +1507,7 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
1506
1507
None ,
1507
1508
false ,
1508
1509
None ,
1510
+ None ,
1509
1511
) {
1510
1512
let desc = match binding. res ( ) {
1511
1513
Res :: Def ( DefKind :: Macro ( MacroKind :: Bang ) , _) => {
@@ -1983,6 +1985,7 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
1983
1985
parent_scope : & ParentScope < ' a > ,
1984
1986
ribs : Option < & PerNS < Vec < Rib < ' a > > > > ,
1985
1987
ignore_binding : Option < NameBinding < ' a > > ,
1988
+ ignore_import : Option < Import < ' a > > ,
1986
1989
module : Option < ModuleOrUniformRoot < ' a > > ,
1987
1990
failed_segment_idx : usize ,
1988
1991
ident : Ident ,
@@ -2066,11 +2069,13 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
2066
2069
parent_scope,
2067
2070
None ,
2068
2071
ignore_binding,
2072
+ ignore_import,
2069
2073
)
2070
2074
. ok ( )
2071
2075
} else if let Some ( ribs) = ribs
2072
2076
&& let Some ( TypeNS | ValueNS ) = opt_ns
2073
2077
{
2078
+ assert ! ( ignore_import. is_none( ) ) ;
2074
2079
match self . resolve_ident_in_lexical_scope (
2075
2080
ident,
2076
2081
ns_to_try,
@@ -2091,6 +2096,7 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
2091
2096
None ,
2092
2097
false ,
2093
2098
ignore_binding,
2099
+ ignore_import,
2094
2100
)
2095
2101
. ok ( )
2096
2102
} ;
@@ -2132,6 +2138,7 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
2132
2138
} else if ident. name . as_str ( ) . chars ( ) . next ( ) . is_some_and ( |c| c. is_ascii_uppercase ( ) ) {
2133
2139
// Check whether the name refers to an item in the value namespace.
2134
2140
let binding = if let Some ( ribs) = ribs {
2141
+ assert ! ( ignore_import. is_none( ) ) ;
2135
2142
self . resolve_ident_in_lexical_scope (
2136
2143
ident,
2137
2144
ValueNS ,
@@ -2206,6 +2213,7 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
2206
2213
None ,
2207
2214
false ,
2208
2215
ignore_binding,
2216
+ ignore_import,
2209
2217
) {
2210
2218
let descr = binding. res ( ) . descr ( ) ;
2211
2219
( format ! ( "{descr} `{ident}` is not a crate or module" ) , suggestion)
@@ -2259,7 +2267,7 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
2259
2267
) -> Option < ( Vec < Segment > , Option < String > ) > {
2260
2268
// Replace first ident with `self` and check if that is valid.
2261
2269
path[ 0 ] . ident . name = kw:: SelfLower ;
2262
- let result = self . maybe_resolve_path ( & path, None , parent_scope) ;
2270
+ let result = self . maybe_resolve_path ( & path, None , parent_scope, None ) ;
2263
2271
debug ! ( "make_missing_self_suggestion: path={:?} result={:?}" , path, result) ;
2264
2272
if let PathResult :: Module ( ..) = result { Some ( ( path, None ) ) } else { None }
2265
2273
}
@@ -2278,7 +2286,7 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
2278
2286
) -> Option < ( Vec < Segment > , Option < String > ) > {
2279
2287
// Replace first ident with `crate` and check if that is valid.
2280
2288
path[ 0 ] . ident . name = kw:: Crate ;
2281
- let result = self . maybe_resolve_path ( & path, None , parent_scope) ;
2289
+ let result = self . maybe_resolve_path ( & path, None , parent_scope, None ) ;
2282
2290
debug ! ( "make_missing_crate_suggestion: path={:?} result={:?}" , path, result) ;
2283
2291
if let PathResult :: Module ( ..) = result {
2284
2292
Some ( (
@@ -2309,7 +2317,7 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
2309
2317
) -> Option < ( Vec < Segment > , Option < String > ) > {
2310
2318
// Replace first ident with `crate` and check if that is valid.
2311
2319
path[ 0 ] . ident . name = kw:: Super ;
2312
- let result = self . maybe_resolve_path ( & path, None , parent_scope) ;
2320
+ let result = self . maybe_resolve_path ( & path, None , parent_scope, None ) ;
2313
2321
debug ! ( "make_missing_super_suggestion: path={:?} result={:?}" , path, result) ;
2314
2322
if let PathResult :: Module ( ..) = result { Some ( ( path, None ) ) } else { None }
2315
2323
}
@@ -2343,7 +2351,7 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
2343
2351
for name in extern_crate_names. into_iter ( ) {
2344
2352
// Replace first ident with a crate name and check if that is valid.
2345
2353
path[ 0 ] . ident . name = name;
2346
- let result = self . maybe_resolve_path ( & path, None , parent_scope) ;
2354
+ let result = self . maybe_resolve_path ( & path, None , parent_scope, None ) ;
2347
2355
debug ! (
2348
2356
"make_external_crate_suggestion: name={:?} path={:?} result={:?}" ,
2349
2357
name, path, result
@@ -2509,12 +2517,7 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
2509
2517
}
2510
2518
2511
2519
/// Finds a cfg-ed out item inside `module` with the matching name.
2512
- pub ( crate ) fn find_cfg_stripped (
2513
- & mut self ,
2514
- err : & mut Diag < ' _ > ,
2515
- segment : & Symbol ,
2516
- module : DefId ,
2517
- ) {
2520
+ pub ( crate ) fn find_cfg_stripped ( & self , err : & mut Diag < ' _ > , segment : & Symbol , module : DefId ) {
2518
2521
let local_items;
2519
2522
let symbols = if module. is_local ( ) {
2520
2523
local_items = self
0 commit comments