@@ -1052,6 +1052,7 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
10521052 parent_scope,
10531053 false ,
10541054 false ,
1055+ None ,
10551056 ) {
10561057 suggestions. extend (
10571058 ext. helper_attrs
@@ -1506,6 +1507,7 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
15061507 None ,
15071508 false ,
15081509 None ,
1510+ None ,
15091511 ) {
15101512 let desc = match binding. res ( ) {
15111513 Res :: Def ( DefKind :: Macro ( MacroKind :: Bang ) , _) => {
@@ -1983,6 +1985,7 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
19831985 parent_scope : & ParentScope < ' a > ,
19841986 ribs : Option < & PerNS < Vec < Rib < ' a > > > > ,
19851987 ignore_binding : Option < NameBinding < ' a > > ,
1988+ ignore_import : Option < Import < ' a > > ,
19861989 module : Option < ModuleOrUniformRoot < ' a > > ,
19871990 failed_segment_idx : usize ,
19881991 ident : Ident ,
@@ -2066,11 +2069,13 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
20662069 parent_scope,
20672070 None ,
20682071 ignore_binding,
2072+ ignore_import,
20692073 )
20702074 . ok ( )
20712075 } else if let Some ( ribs) = ribs
20722076 && let Some ( TypeNS | ValueNS ) = opt_ns
20732077 {
2078+ assert ! ( ignore_import. is_none( ) ) ;
20742079 match self . resolve_ident_in_lexical_scope (
20752080 ident,
20762081 ns_to_try,
@@ -2091,6 +2096,7 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
20912096 None ,
20922097 false ,
20932098 ignore_binding,
2099+ ignore_import,
20942100 )
20952101 . ok ( )
20962102 } ;
@@ -2132,6 +2138,7 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
21322138 } else if ident. name . as_str ( ) . chars ( ) . next ( ) . is_some_and ( |c| c. is_ascii_uppercase ( ) ) {
21332139 // Check whether the name refers to an item in the value namespace.
21342140 let binding = if let Some ( ribs) = ribs {
2141+ assert ! ( ignore_import. is_none( ) ) ;
21352142 self . resolve_ident_in_lexical_scope (
21362143 ident,
21372144 ValueNS ,
@@ -2206,6 +2213,7 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
22062213 None ,
22072214 false ,
22082215 ignore_binding,
2216+ ignore_import,
22092217 ) {
22102218 let descr = binding. res ( ) . descr ( ) ;
22112219 ( format ! ( "{descr} `{ident}` is not a crate or module" ) , suggestion)
@@ -2259,7 +2267,7 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
22592267 ) -> Option < ( Vec < Segment > , Option < String > ) > {
22602268 // Replace first ident with `self` and check if that is valid.
22612269 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 ) ;
22632271 debug ! ( "make_missing_self_suggestion: path={:?} result={:?}" , path, result) ;
22642272 if let PathResult :: Module ( ..) = result { Some ( ( path, None ) ) } else { None }
22652273 }
@@ -2278,7 +2286,7 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
22782286 ) -> Option < ( Vec < Segment > , Option < String > ) > {
22792287 // Replace first ident with `crate` and check if that is valid.
22802288 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 ) ;
22822290 debug ! ( "make_missing_crate_suggestion: path={:?} result={:?}" , path, result) ;
22832291 if let PathResult :: Module ( ..) = result {
22842292 Some ( (
@@ -2309,7 +2317,7 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
23092317 ) -> Option < ( Vec < Segment > , Option < String > ) > {
23102318 // Replace first ident with `crate` and check if that is valid.
23112319 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 ) ;
23132321 debug ! ( "make_missing_super_suggestion: path={:?} result={:?}" , path, result) ;
23142322 if let PathResult :: Module ( ..) = result { Some ( ( path, None ) ) } else { None }
23152323 }
@@ -2343,7 +2351,7 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
23432351 for name in extern_crate_names. into_iter ( ) {
23442352 // Replace first ident with a crate name and check if that is valid.
23452353 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 ) ;
23472355 debug ! (
23482356 "make_external_crate_suggestion: name={:?} path={:?} result={:?}" ,
23492357 name, path, result
@@ -2509,12 +2517,7 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
25092517 }
25102518
25112519 /// 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 ) {
25182521 let local_items;
25192522 let symbols = if module. is_local ( ) {
25202523 local_items = self
0 commit comments