@@ -24,10 +24,8 @@ use tracing::debug;
24
24
use crate :: imports:: { Import , ImportKind , ImportResolver } ;
25
25
use crate :: path_names_to_string;
26
26
use 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 } ;
31
29
use crate :: { ParentScope , PathResult , ResolutionError , Resolver , Scope , ScopeSet , Segment } ;
32
30
33
31
type Res = def:: Res < ast:: NodeId > ;
@@ -1076,9 +1074,8 @@ impl<'a> Resolver<'a> {
1076
1074
ident,
1077
1075
ScopeSet :: All ( ns, false ) ,
1078
1076
& parent_scope,
1077
+ None ,
1079
1078
false ,
1080
- false ,
1081
- ident. span ,
1082
1079
) {
1083
1080
let desc = match binding. res ( ) {
1084
1081
Res :: Def ( DefKind :: Macro ( MacroKind :: Bang ) , _) => {
@@ -1405,10 +1402,10 @@ impl<'a, 'b> ImportResolver<'a, 'b> {
1405
1402
_ => return None ,
1406
1403
}
1407
1404
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) )
1412
1409
}
1413
1410
1414
1411
/// Suggest a missing `self::` if that resolves to an correct module.
@@ -1420,13 +1417,12 @@ impl<'a, 'b> ImportResolver<'a, 'b> {
1420
1417
/// ```
1421
1418
fn make_missing_self_suggestion (
1422
1419
& mut self ,
1423
- span : Span ,
1424
1420
mut path : Vec < Segment > ,
1425
1421
parent_scope : & ParentScope < ' b > ,
1426
1422
) -> Option < ( Vec < Segment > , Vec < String > ) > {
1427
1423
// Replace first ident with `self` and check if that is valid.
1428
1424
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 ) ;
1430
1426
debug ! ( "make_missing_self_suggestion: path={:?} result={:?}" , path, result) ;
1431
1427
if let PathResult :: Module ( ..) = result { Some ( ( path, Vec :: new ( ) ) ) } else { None }
1432
1428
}
@@ -1440,13 +1436,12 @@ impl<'a, 'b> ImportResolver<'a, 'b> {
1440
1436
/// ```
1441
1437
fn make_missing_crate_suggestion (
1442
1438
& mut self ,
1443
- span : Span ,
1444
1439
mut path : Vec < Segment > ,
1445
1440
parent_scope : & ParentScope < ' b > ,
1446
1441
) -> Option < ( Vec < Segment > , Vec < String > ) > {
1447
1442
// Replace first ident with `crate` and check if that is valid.
1448
1443
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 ) ;
1450
1445
debug ! ( "make_missing_crate_suggestion: path={:?} result={:?}" , path, result) ;
1451
1446
if let PathResult :: Module ( ..) = result {
1452
1447
Some ( (
@@ -1472,13 +1467,12 @@ impl<'a, 'b> ImportResolver<'a, 'b> {
1472
1467
/// ```
1473
1468
fn make_missing_super_suggestion (
1474
1469
& mut self ,
1475
- span : Span ,
1476
1470
mut path : Vec < Segment > ,
1477
1471
parent_scope : & ParentScope < ' b > ,
1478
1472
) -> Option < ( Vec < Segment > , Vec < String > ) > {
1479
1473
// Replace first ident with `crate` and check if that is valid.
1480
1474
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 ) ;
1482
1476
debug ! ( "make_missing_super_suggestion: path={:?} result={:?}" , path, result) ;
1483
1477
if let PathResult :: Module ( ..) = result { Some ( ( path, Vec :: new ( ) ) ) } else { None }
1484
1478
}
@@ -1495,7 +1489,6 @@ impl<'a, 'b> ImportResolver<'a, 'b> {
1495
1489
/// name as the first part of path.
1496
1490
fn make_external_crate_suggestion (
1497
1491
& mut self ,
1498
- span : Span ,
1499
1492
mut path : Vec < Segment > ,
1500
1493
parent_scope : & ParentScope < ' b > ,
1501
1494
) -> Option < ( Vec < Segment > , Vec < String > ) > {
@@ -1513,7 +1506,7 @@ impl<'a, 'b> ImportResolver<'a, 'b> {
1513
1506
for name in extern_crate_names. into_iter ( ) {
1514
1507
// Replace first ident with a crate name and check if that is valid.
1515
1508
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 ) ;
1517
1510
debug ! (
1518
1511
"make_external_crate_suggestion: name={:?} path={:?} result={:?}" ,
1519
1512
name, path, result
0 commit comments