@@ -875,12 +875,6 @@ impl<'a, 'b> ImportResolver<'a, 'b> {
875
875
/// consolidate multiple unresolved import errors into a single diagnostic.
876
876
fn finalize_import ( & mut self , import : & ' b Import < ' b > ) -> Option < UnresolvedImportError > {
877
877
let orig_vis = import. vis . replace ( ty:: Visibility :: Invisible ) ;
878
- let orig_unusable_binding = match & import. kind {
879
- ImportKind :: Single { target_bindings, .. } => {
880
- Some ( mem:: replace ( & mut self . r . unusable_binding , target_bindings[ TypeNS ] . get ( ) ) )
881
- }
882
- _ => None ,
883
- } ;
884
878
let prev_ambiguity_errors_len = self . r . ambiguity_errors . len ( ) ;
885
879
let path_res = self . r . resolve_path (
886
880
& import. module_path ,
@@ -891,9 +885,6 @@ impl<'a, 'b> ImportResolver<'a, 'b> {
891
885
import. crate_lint ( ) ,
892
886
) ;
893
887
let no_ambiguity = self . r . ambiguity_errors . len ( ) == prev_ambiguity_errors_len;
894
- if let Some ( orig_unusable_binding) = orig_unusable_binding {
895
- self . r . unusable_binding = orig_unusable_binding;
896
- }
897
888
import. vis . set ( orig_vis) ;
898
889
if let PathResult :: Failed { .. } | PathResult :: NonModule ( ..) = path_res {
899
890
// Consider erroneous imports used to avoid duplicate diagnostics.
@@ -904,7 +895,8 @@ impl<'a, 'b> ImportResolver<'a, 'b> {
904
895
// Consistency checks, analogous to `finalize_macro_resolutions`.
905
896
if let Some ( initial_module) = import. imported_module . get ( ) {
906
897
if !ModuleOrUniformRoot :: same_def ( module, initial_module) && no_ambiguity {
907
- span_bug ! ( import. span, "inconsistent resolution for an import" ) ;
898
+ let msg = "inconsistent resolution for an import" ;
899
+ self . r . session . span_err ( import. span , msg) ;
908
900
}
909
901
} else {
910
902
if self . r . privacy_errors . is_empty ( ) {
@@ -926,7 +918,6 @@ impl<'a, 'b> ImportResolver<'a, 'b> {
926
918
}
927
919
PathResult :: Failed { is_error_from_last_segment : true , span, label, suggestion } => {
928
920
if no_ambiguity {
929
- assert ! ( import. imported_module. get( ) . is_none( ) ) ;
930
921
let err = match self . make_path_suggestion (
931
922
span,
932
923
import. module_path . clone ( ) ,
0 commit comments