@@ -44,7 +44,7 @@ use crate::{
4444 errors as errs, path_names_to_string, AmbiguityError , AmbiguityErrorMisc , AmbiguityKind ,
4545 BindingError , BindingKey , Finalize , HasGenericParams , LexicalScopeBinding , MacroRulesScope ,
4646 Module , ModuleKind , ModuleOrUniformRoot , NameBinding , NameBindingKind , ParentScope , PathResult ,
47- PrivacyError , ResolutionError , Resolver , Scope , ScopeSet , Segment , UseError , Used ,
47+ PrivacyError , ResolutionError , Resolver , Scope , ScopeSet , Segment , UseError , Used , UsedImport ,
4848 VisResolutionError ,
4949} ;
5050
@@ -1050,6 +1050,7 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
10501050 derive,
10511051 Some ( MacroKind :: Derive ) ,
10521052 parent_scope,
1053+ None ,
10531054 false ,
10541055 false ,
10551056 ) {
@@ -1504,6 +1505,7 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
15041505 ScopeSet :: All ( ns) ,
15051506 parent_scope,
15061507 None ,
1508+ None ,
15071509 false ,
15081510 None ,
15091511 ) {
@@ -1981,6 +1983,7 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
19811983 path : & [ Segment ] ,
19821984 opt_ns : Option < Namespace > , // `None` indicates a module path in import
19831985 parent_scope : & ParentScope < ' a > ,
1986+ used_import : UsedImport < ' a > ,
19841987 ribs : Option < & PerNS < Vec < Rib < ' a > > > > ,
19851988 ignore_binding : Option < NameBinding < ' a > > ,
19861989 module : Option < ModuleOrUniformRoot < ' a > > ,
@@ -2064,6 +2067,7 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
20642067 ident,
20652068 ns_to_try,
20662069 parent_scope,
2070+ used_import,
20672071 None ,
20682072 ignore_binding,
20692073 )
@@ -2075,6 +2079,7 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
20752079 ident,
20762080 ns_to_try,
20772081 parent_scope,
2082+ used_import,
20782083 None ,
20792084 & ribs[ ns_to_try] ,
20802085 ignore_binding,
@@ -2088,6 +2093,7 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
20882093 ident,
20892094 ScopeSet :: All ( ns_to_try) ,
20902095 parent_scope,
2096+ used_import,
20912097 None ,
20922098 false ,
20932099 ignore_binding,
@@ -2136,6 +2142,7 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
21362142 ident,
21372143 ValueNS ,
21382144 parent_scope,
2145+ used_import,
21392146 None ,
21402147 & ribs[ ValueNS ] ,
21412148 ignore_binding,
@@ -2203,6 +2210,7 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
22032210 ident,
22042211 ScopeSet :: All ( ValueNS ) ,
22052212 parent_scope,
2213+ used_import,
22062214 None ,
22072215 false ,
22082216 ignore_binding,
@@ -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
0 commit comments