@@ -8,8 +8,8 @@ use crate::errors::{
88 ItemsInTraitsAreNotImportable ,
99} ;
1010use crate :: Determinacy :: { self , * } ;
11- use crate :: Namespace :: * ;
1211use crate :: { module_to_string, names_to_string, ImportSuggestion } ;
12+ use crate :: { AmbiguityError , Namespace :: * } ;
1313use crate :: { AmbiguityKind , BindingKey , ResolutionError , Resolver , Segment } ;
1414use crate :: { Finalize , Module , ModuleOrUniformRoot , ParentScope , PerNS , ScopeSet } ;
1515use crate :: { NameBinding , NameBindingData , NameBindingKind , PathResult , Used } ;
@@ -538,7 +538,6 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
538538 . chain ( indeterminate_imports. iter ( ) . map ( |i| ( true , i) ) )
539539 {
540540 let unresolved_import_error = self . finalize_import ( * import) ;
541-
542541 // If this import is unresolved then create a dummy import
543542 // resolution for it so that later resolve stages won't complain.
544543 self . import_dummy_binding ( * import, is_indeterminate) ;
@@ -856,7 +855,9 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
856855 ImportKind :: Single { target_bindings, .. } => target_bindings[ TypeNS ] . get ( ) ,
857856 _ => None ,
858857 } ;
859- let prev_ambiguity_errors_len = self . ambiguity_errors . len ( ) ;
858+ let ambiguity_errors_len =
859+ |errors : & Vec < AmbiguityError < ' _ > > | errors. iter ( ) . filter ( |error| !error. warning ) . count ( ) ;
860+ let prev_ambiguity_errors_len = ambiguity_errors_len ( & self . ambiguity_errors ) ;
860861 let finalize = Finalize :: with_root_span ( import. root_id , import. span , import. root_span ) ;
861862
862863 // We'll provide more context to the privacy errors later, up to `len`.
@@ -870,7 +871,8 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
870871 ignore_binding,
871872 ) ;
872873
873- let no_ambiguity = self . ambiguity_errors . len ( ) == prev_ambiguity_errors_len;
874+ let no_ambiguity =
875+ ambiguity_errors_len ( & self . ambiguity_errors ) == prev_ambiguity_errors_len;
874876 import. vis . set ( orig_vis) ;
875877 let module = match path_res {
876878 PathResult :: Module ( module) => {
0 commit comments