@@ -279,7 +279,7 @@ impl<'a> Resolver<'a> {
279
279
mut ident : Ident ,
280
280
ns : Namespace ,
281
281
parent_scope : & ParentScope < ' a > ,
282
- finalize_full : Option < Finalize > ,
282
+ finalize : Option < Finalize > ,
283
283
ribs : & [ Rib < ' a > ] ,
284
284
unusable_binding : Option < & ' a NameBinding < ' a > > ,
285
285
) -> Option < LexicalScopeBinding < ' a > > {
@@ -302,7 +302,6 @@ impl<'a> Resolver<'a> {
302
302
let normalized_ident = Ident { span : normalized_span, ..ident } ;
303
303
304
304
// Walk backwards up the ribs in scope.
305
- let finalize = finalize_full. map ( |finalize| finalize. path_span ) ;
306
305
let mut module = self . graph_root ;
307
306
for i in ( 0 ..ribs. len ( ) ) . rev ( ) {
308
307
debug ! ( "walk rib\n {:?}" , ribs[ i] . bindings) ;
@@ -316,7 +315,7 @@ impl<'a> Resolver<'a> {
316
315
i,
317
316
rib_ident,
318
317
* res,
319
- finalize,
318
+ finalize. map ( |finalize| finalize . path_span ) ,
320
319
* original_rib_ident_def,
321
320
ribs,
322
321
) ) ) ;
@@ -354,7 +353,7 @@ impl<'a> Resolver<'a> {
354
353
}
355
354
self . early_resolve_ident_in_lexical_scope (
356
355
orig_ident,
357
- ScopeSet :: Late ( ns, module, finalize_full . map ( |finalize| finalize. node_id ) ) ,
356
+ ScopeSet :: Late ( ns, module, finalize . map ( |finalize| finalize. node_id ) ) ,
358
357
parent_scope,
359
358
finalize,
360
359
finalize. is_some ( ) ,
@@ -376,7 +375,7 @@ impl<'a> Resolver<'a> {
376
375
orig_ident : Ident ,
377
376
scope_set : ScopeSet < ' a > ,
378
377
parent_scope : & ParentScope < ' a > ,
379
- finalize : Option < Span > ,
378
+ finalize : Option < Finalize > ,
380
379
force : bool ,
381
380
last_import_segment : bool ,
382
381
unusable_binding : Option < & ' a NameBinding < ' a > > ,
@@ -742,7 +741,7 @@ impl<'a> Resolver<'a> {
742
741
ident : Ident ,
743
742
ns : Namespace ,
744
743
parent_scope : & ParentScope < ' a > ,
745
- finalize : Option < Span > ,
744
+ finalize : Option < Finalize > ,
746
745
// We are resolving a last import segment during import validation.
747
746
last_import_segment : bool ,
748
747
// This binding should be ignored during in-module resolution, so that we don't get
@@ -768,7 +767,7 @@ impl<'a> Resolver<'a> {
768
767
mut ident : Ident ,
769
768
ns : Namespace ,
770
769
parent_scope : & ParentScope < ' a > ,
771
- finalize : Option < Span > ,
770
+ finalize : Option < Finalize > ,
772
771
last_import_segment : bool ,
773
772
unusable_binding : Option < & ' a NameBinding < ' a > > ,
774
773
) -> Result < & ' a NameBinding < ' a > , ( Determinacy , Weak ) > {
@@ -808,7 +807,7 @@ impl<'a> Resolver<'a> {
808
807
ident : Ident ,
809
808
ns : Namespace ,
810
809
parent_scope : & ParentScope < ' a > ,
811
- finalize : Option < Span > ,
810
+ finalize : Option < Finalize > ,
812
811
last_import_segment : bool ,
813
812
unusable_binding : Option < & ' a NameBinding < ' a > > ,
814
813
) -> Result < & ' a NameBinding < ' a > , Determinacy > {
@@ -835,7 +834,7 @@ impl<'a> Resolver<'a> {
835
834
ns : Namespace ,
836
835
parent_scope : & ParentScope < ' a > ,
837
836
restricted_shadowing : bool ,
838
- finalize : Option < Span > ,
837
+ finalize : Option < Finalize > ,
839
838
last_import_segment : bool ,
840
839
unusable_binding : Option < & ' a NameBinding < ' a > > ,
841
840
) -> Result < & ' a NameBinding < ' a > , ( Determinacy , Weak ) > {
@@ -901,7 +900,7 @@ impl<'a> Resolver<'a> {
901
900
let resolution =
902
901
self . resolution ( module, key) . try_borrow_mut ( ) . map_err ( |_| ( Determined , Weak :: No ) ) ?; // This happens when there is a cycle of imports.
903
902
904
- if let Some ( path_span) = finalize {
903
+ if let Some ( Finalize { path_span, .. } ) = finalize {
905
904
// If the primary binding is unusable, search further and return the shadowed glob
906
905
// binding if it exists. What we really want here is having two separate scopes in
907
906
// a module - one for non-globs and one for globs, but until that's done use this
@@ -1391,13 +1390,12 @@ impl<'a> Resolver<'a> {
1391
1390
path : & [ Segment ] ,
1392
1391
opt_ns : Option < Namespace > , // `None` indicates a module path in import
1393
1392
parent_scope : & ParentScope < ' a > ,
1394
- finalize_full : Option < Finalize > ,
1393
+ finalize : Option < Finalize > ,
1395
1394
ribs : Option < & PerNS < Vec < Rib < ' a > > > > ,
1396
1395
unusable_binding : Option < & ' a NameBinding < ' a > > ,
1397
1396
) -> PathResult < ' a > {
1398
- debug ! ( "resolve_path(path={:?}, opt_ns={:?}, finalize={:?})" , path, opt_ns, finalize_full ) ;
1397
+ debug ! ( "resolve_path(path={:?}, opt_ns={:?}, finalize={:?})" , path, opt_ns, finalize ) ;
1399
1398
1400
- let finalize = finalize_full. map ( |finalize| finalize. path_span ) ;
1401
1399
let mut module = None ;
1402
1400
let mut allow_super = true ;
1403
1401
let mut second_binding = None ;
@@ -1507,7 +1505,7 @@ impl<'a> Resolver<'a> {
1507
1505
ident,
1508
1506
ns,
1509
1507
parent_scope,
1510
- finalize_full ,
1508
+ finalize ,
1511
1509
& ribs[ ns] ,
1512
1510
unusable_binding,
1513
1511
) {
@@ -1566,7 +1564,7 @@ impl<'a> Resolver<'a> {
1566
1564
} else if res == Res :: Err {
1567
1565
return PathResult :: NonModule ( PartialRes :: new ( Res :: Err ) ) ;
1568
1566
} else if opt_ns. is_some ( ) && ( is_last || maybe_assoc) {
1569
- self . lint_if_path_starts_with_module ( finalize_full , path, second_binding) ;
1567
+ self . lint_if_path_starts_with_module ( finalize , path, second_binding) ;
1570
1568
return PathResult :: NonModule ( PartialRes :: with_unresolved_segments (
1571
1569
res,
1572
1570
path. len ( ) - i - 1 ,
@@ -1609,7 +1607,7 @@ impl<'a> Resolver<'a> {
1609
1607
}
1610
1608
}
1611
1609
1612
- self . lint_if_path_starts_with_module ( finalize_full , path, second_binding) ;
1610
+ self . lint_if_path_starts_with_module ( finalize , path, second_binding) ;
1613
1611
1614
1612
PathResult :: Module ( match module {
1615
1613
Some ( module) => module,
0 commit comments