@@ -343,7 +343,6 @@ impl<'a> Resolver<'a> {
343
343
ns,
344
344
parent_scope,
345
345
finalize,
346
- false ,
347
346
unusable_binding,
348
347
) ;
349
348
if let Ok ( binding) = item {
@@ -357,7 +356,6 @@ impl<'a> Resolver<'a> {
357
356
parent_scope,
358
357
finalize,
359
358
finalize. is_some ( ) ,
360
- false ,
361
359
unusable_binding,
362
360
)
363
361
. ok ( )
@@ -377,7 +375,6 @@ impl<'a> Resolver<'a> {
377
375
parent_scope : & ParentScope < ' a > ,
378
376
finalize : Option < Finalize > ,
379
377
force : bool ,
380
- last_import_segment : bool ,
381
378
unusable_binding : Option < & ' a NameBinding < ' a > > ,
382
379
) -> Result < & ' a NameBinding < ' a > , Determinacy > {
383
380
bitflags:: bitflags! {
@@ -498,7 +495,6 @@ impl<'a> Resolver<'a> {
498
495
ns,
499
496
parent_scope,
500
497
finalize,
501
- last_import_segment,
502
498
unusable_binding,
503
499
) ;
504
500
match binding {
@@ -521,7 +517,6 @@ impl<'a> Resolver<'a> {
521
517
adjusted_parent_scope,
522
518
!matches ! ( scope_set, ScopeSet :: Late ( ..) ) ,
523
519
finalize,
524
- last_import_segment,
525
520
unusable_binding,
526
521
) ;
527
522
match binding {
@@ -607,7 +602,6 @@ impl<'a> Resolver<'a> {
607
602
ns,
608
603
parent_scope,
609
604
None ,
610
- last_import_segment,
611
605
unusable_binding,
612
606
) {
613
607
if use_prelude || this. is_builtin_macro ( binding. res ( ) ) {
@@ -730,7 +724,7 @@ impl<'a> Resolver<'a> {
730
724
ns : Namespace ,
731
725
parent_scope : & ParentScope < ' a > ,
732
726
) -> Result < & ' a NameBinding < ' a > , Determinacy > {
733
- self . resolve_ident_in_module_ext ( module, ident, ns, parent_scope, None , false , None )
727
+ self . resolve_ident_in_module_ext ( module, ident, ns, parent_scope, None , None )
734
728
. map_err ( |( determinacy, _) | determinacy)
735
729
}
736
730
@@ -742,8 +736,6 @@ impl<'a> Resolver<'a> {
742
736
ns : Namespace ,
743
737
parent_scope : & ParentScope < ' a > ,
744
738
finalize : Option < Finalize > ,
745
- // We are resolving a last import segment during import validation.
746
- last_import_segment : bool ,
747
739
// This binding should be ignored during in-module resolution, so that we don't get
748
740
// "self-confirming" import resolutions during import validation.
749
741
unusable_binding : Option < & ' a NameBinding < ' a > > ,
@@ -754,7 +746,6 @@ impl<'a> Resolver<'a> {
754
746
ns,
755
747
parent_scope,
756
748
finalize,
757
- last_import_segment,
758
749
unusable_binding,
759
750
)
760
751
. map_err ( |( determinacy, _) | determinacy)
@@ -768,7 +759,6 @@ impl<'a> Resolver<'a> {
768
759
ns : Namespace ,
769
760
parent_scope : & ParentScope < ' a > ,
770
761
finalize : Option < Finalize > ,
771
- last_import_segment : bool ,
772
762
unusable_binding : Option < & ' a NameBinding < ' a > > ,
773
763
) -> Result < & ' a NameBinding < ' a > , ( Determinacy , Weak ) > {
774
764
let tmp_parent_scope;
@@ -795,7 +785,6 @@ impl<'a> Resolver<'a> {
795
785
adjusted_parent_scope,
796
786
false ,
797
787
finalize,
798
- last_import_segment,
799
788
unusable_binding,
800
789
)
801
790
}
@@ -808,7 +797,6 @@ impl<'a> Resolver<'a> {
808
797
ns : Namespace ,
809
798
parent_scope : & ParentScope < ' a > ,
810
799
finalize : Option < Finalize > ,
811
- last_import_segment : bool ,
812
800
unusable_binding : Option < & ' a NameBinding < ' a > > ,
813
801
) -> Result < & ' a NameBinding < ' a > , Determinacy > {
814
802
self . resolve_ident_in_module_unadjusted_ext (
@@ -818,7 +806,6 @@ impl<'a> Resolver<'a> {
818
806
parent_scope,
819
807
false ,
820
808
finalize,
821
- last_import_segment,
822
809
unusable_binding,
823
810
)
824
811
. map_err ( |( determinacy, _) | determinacy)
@@ -835,7 +822,6 @@ impl<'a> Resolver<'a> {
835
822
parent_scope : & ParentScope < ' a > ,
836
823
restricted_shadowing : bool ,
837
824
finalize : Option < Finalize > ,
838
- last_import_segment : bool ,
839
825
unusable_binding : Option < & ' a NameBinding < ' a > > ,
840
826
) -> Result < & ' a NameBinding < ' a > , ( Determinacy , Weak ) > {
841
827
let module = match module {
@@ -848,7 +834,6 @@ impl<'a> Resolver<'a> {
848
834
parent_scope,
849
835
finalize,
850
836
finalize. is_some ( ) ,
851
- last_import_segment,
852
837
unusable_binding,
853
838
) ;
854
839
return binding. map_err ( |determinacy| ( determinacy, Weak :: No ) ) ;
@@ -889,7 +874,6 @@ impl<'a> Resolver<'a> {
889
874
parent_scope,
890
875
finalize,
891
876
finalize. is_some ( ) ,
892
- last_import_segment,
893
877
unusable_binding,
894
878
) ;
895
879
return binding. map_err ( |determinacy| ( determinacy, Weak :: No ) ) ;
@@ -900,7 +884,7 @@ impl<'a> Resolver<'a> {
900
884
let resolution =
901
885
self . resolution ( module, key) . try_borrow_mut ( ) . map_err ( |_| ( Determined , Weak :: No ) ) ?; // This happens when there is a cycle of imports.
902
886
903
- if let Some ( Finalize { path_span, .. } ) = finalize {
887
+ if let Some ( Finalize { path_span, report_private , .. } ) = finalize {
904
888
// If the primary binding is unusable, search further and return the shadowed glob
905
889
// binding if it exists. What we really want here is having two separate scopes in
906
890
// a module - one for non-globs and one for globs, but until that's done use this
@@ -921,14 +905,14 @@ impl<'a> Resolver<'a> {
921
905
} ;
922
906
923
907
if !self . is_accessible_from ( binding. vis , parent_scope. module ) {
924
- if last_import_segment {
925
- return Err ( ( Determined , Weak :: No ) ) ;
926
- } else {
908
+ if report_private {
927
909
self . privacy_errors . push ( PrivacyError {
928
910
ident,
929
911
binding,
930
912
dedup_span : path_span,
931
913
} ) ;
914
+ } else {
915
+ return Err ( ( Determined , Weak :: No ) ) ;
932
916
}
933
917
}
934
918
@@ -995,7 +979,6 @@ impl<'a> Resolver<'a> {
995
979
ns,
996
980
& single_import. parent_scope ,
997
981
None ,
998
- last_import_segment,
999
982
unusable_binding,
1000
983
) {
1001
984
Err ( Determined ) => continue ,
@@ -1072,7 +1055,6 @@ impl<'a> Resolver<'a> {
1072
1055
ns,
1073
1056
adjusted_parent_scope,
1074
1057
None ,
1075
- last_import_segment,
1076
1058
unusable_binding,
1077
1059
) ;
1078
1060
@@ -1495,7 +1477,6 @@ impl<'a> Resolver<'a> {
1495
1477
ns,
1496
1478
parent_scope,
1497
1479
finalize,
1498
- false ,
1499
1480
unusable_binding,
1500
1481
)
1501
1482
} else if let Some ( ribs) = ribs
@@ -1523,7 +1504,6 @@ impl<'a> Resolver<'a> {
1523
1504
parent_scope,
1524
1505
finalize,
1525
1506
finalize. is_some ( ) ,
1526
- false ,
1527
1507
unusable_binding,
1528
1508
)
1529
1509
} ;
0 commit comments