@@ -24,10 +24,8 @@ use tracing::debug;
2424use crate :: imports:: { Import , ImportKind , ImportResolver } ;
2525use crate :: path_names_to_string;
2626use crate :: { AmbiguityError , AmbiguityErrorMisc , AmbiguityKind } ;
27- use crate :: {
28- BindingError , CrateLint , HasGenericParams , MacroRulesScope , Module , ModuleOrUniformRoot ,
29- } ;
30- use crate :: { NameBinding , NameBindingKind , PrivacyError , VisResolutionError } ;
27+ use crate :: { BindingError , HasGenericParams , MacroRulesScope , Module , ModuleOrUniformRoot } ;
28+ use crate :: { Finalize , NameBinding , NameBindingKind , PrivacyError , VisResolutionError } ;
3129use crate :: { ParentScope , PathResult , ResolutionError , Resolver , Scope , ScopeSet , Segment } ;
3230
3331type Res = def:: Res < ast:: NodeId > ;
@@ -1076,9 +1074,8 @@ impl<'a> Resolver<'a> {
10761074 ident,
10771075 ScopeSet :: All ( ns, false ) ,
10781076 & parent_scope,
1077+ None ,
10791078 false ,
1080- false ,
1081- ident. span ,
10821079 ) {
10831080 let desc = match binding. res ( ) {
10841081 Res :: Def ( DefKind :: Macro ( MacroKind :: Bang ) , _) => {
@@ -1405,10 +1402,10 @@ impl<'a, 'b> ImportResolver<'a, 'b> {
14051402 _ => return None ,
14061403 }
14071404
1408- self . make_missing_self_suggestion ( span , path. clone ( ) , parent_scope)
1409- . or_else ( || self . make_missing_crate_suggestion ( span , path. clone ( ) , parent_scope) )
1410- . or_else ( || self . make_missing_super_suggestion ( span , path. clone ( ) , parent_scope) )
1411- . or_else ( || self . make_external_crate_suggestion ( span , path, parent_scope) )
1405+ self . make_missing_self_suggestion ( path. clone ( ) , parent_scope)
1406+ . or_else ( || self . make_missing_crate_suggestion ( path. clone ( ) , parent_scope) )
1407+ . or_else ( || self . make_missing_super_suggestion ( path. clone ( ) , parent_scope) )
1408+ . or_else ( || self . make_external_crate_suggestion ( path, parent_scope) )
14121409 }
14131410
14141411 /// Suggest a missing `self::` if that resolves to an correct module.
@@ -1420,13 +1417,12 @@ impl<'a, 'b> ImportResolver<'a, 'b> {
14201417 /// ```
14211418 fn make_missing_self_suggestion (
14221419 & mut self ,
1423- span : Span ,
14241420 mut path : Vec < Segment > ,
14251421 parent_scope : & ParentScope < ' b > ,
14261422 ) -> Option < ( Vec < Segment > , Vec < String > ) > {
14271423 // Replace first ident with `self` and check if that is valid.
14281424 path[ 0 ] . ident . name = kw:: SelfLower ;
1429- let result = self . r . resolve_path ( & path, None , parent_scope, false , span , CrateLint :: No ) ;
1425+ let result = self . r . resolve_path ( & path, None , parent_scope, Finalize :: No ) ;
14301426 debug ! ( "make_missing_self_suggestion: path={:?} result={:?}" , path, result) ;
14311427 if let PathResult :: Module ( ..) = result { Some ( ( path, Vec :: new ( ) ) ) } else { None }
14321428 }
@@ -1440,13 +1436,12 @@ impl<'a, 'b> ImportResolver<'a, 'b> {
14401436 /// ```
14411437 fn make_missing_crate_suggestion (
14421438 & mut self ,
1443- span : Span ,
14441439 mut path : Vec < Segment > ,
14451440 parent_scope : & ParentScope < ' b > ,
14461441 ) -> Option < ( Vec < Segment > , Vec < String > ) > {
14471442 // Replace first ident with `crate` and check if that is valid.
14481443 path[ 0 ] . ident . name = kw:: Crate ;
1449- let result = self . r . resolve_path ( & path, None , parent_scope, false , span , CrateLint :: No ) ;
1444+ let result = self . r . resolve_path ( & path, None , parent_scope, Finalize :: No ) ;
14501445 debug ! ( "make_missing_crate_suggestion: path={:?} result={:?}" , path, result) ;
14511446 if let PathResult :: Module ( ..) = result {
14521447 Some ( (
@@ -1472,13 +1467,12 @@ impl<'a, 'b> ImportResolver<'a, 'b> {
14721467 /// ```
14731468 fn make_missing_super_suggestion (
14741469 & mut self ,
1475- span : Span ,
14761470 mut path : Vec < Segment > ,
14771471 parent_scope : & ParentScope < ' b > ,
14781472 ) -> Option < ( Vec < Segment > , Vec < String > ) > {
14791473 // Replace first ident with `crate` and check if that is valid.
14801474 path[ 0 ] . ident . name = kw:: Super ;
1481- let result = self . r . resolve_path ( & path, None , parent_scope, false , span , CrateLint :: No ) ;
1475+ let result = self . r . resolve_path ( & path, None , parent_scope, Finalize :: No ) ;
14821476 debug ! ( "make_missing_super_suggestion: path={:?} result={:?}" , path, result) ;
14831477 if let PathResult :: Module ( ..) = result { Some ( ( path, Vec :: new ( ) ) ) } else { None }
14841478 }
@@ -1495,7 +1489,6 @@ impl<'a, 'b> ImportResolver<'a, 'b> {
14951489 /// name as the first part of path.
14961490 fn make_external_crate_suggestion (
14971491 & mut self ,
1498- span : Span ,
14991492 mut path : Vec < Segment > ,
15001493 parent_scope : & ParentScope < ' b > ,
15011494 ) -> Option < ( Vec < Segment > , Vec < String > ) > {
@@ -1513,7 +1506,7 @@ impl<'a, 'b> ImportResolver<'a, 'b> {
15131506 for name in extern_crate_names. into_iter ( ) {
15141507 // Replace first ident with a crate name and check if that is valid.
15151508 path[ 0 ] . ident . name = name;
1516- let result = self . r . resolve_path ( & path, None , parent_scope, false , span , CrateLint :: No ) ;
1509+ let result = self . r . resolve_path ( & path, None , parent_scope, Finalize :: No ) ;
15171510 debug ! (
15181511 "make_external_crate_suggestion: name={:?} path={:?} result={:?}" ,
15191512 name, path, result
0 commit comments