@@ -8,8 +8,8 @@ use crate::errors::{
8
8
ItemsInTraitsAreNotImportable ,
9
9
} ;
10
10
use crate :: Determinacy :: { self , * } ;
11
- use crate :: Namespace :: * ;
12
11
use crate :: { module_to_string, names_to_string, ImportSuggestion } ;
12
+ use crate :: { AmbiguityError , Namespace :: * } ;
13
13
use crate :: { AmbiguityKind , BindingKey , ResolutionError , Resolver , Segment } ;
14
14
use crate :: { Finalize , Module , ModuleOrUniformRoot , ParentScope , PerNS , ScopeSet } ;
15
15
use crate :: { NameBinding , NameBindingData , NameBindingKind , PathResult , Used } ;
@@ -538,7 +538,6 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
538
538
. chain ( indeterminate_imports. iter ( ) . map ( |i| ( true , i) ) )
539
539
{
540
540
let unresolved_import_error = self . finalize_import ( * import) ;
541
-
542
541
// If this import is unresolved then create a dummy import
543
542
// resolution for it so that later resolve stages won't complain.
544
543
self . import_dummy_binding ( * import, is_indeterminate) ;
@@ -856,7 +855,9 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
856
855
ImportKind :: Single { target_bindings, .. } => target_bindings[ TypeNS ] . get ( ) ,
857
856
_ => None ,
858
857
} ;
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 ) ;
860
861
let finalize = Finalize :: with_root_span ( import. root_id , import. span , import. root_span ) ;
861
862
862
863
// We'll provide more context to the privacy errors later, up to `len`.
@@ -870,7 +871,8 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
870
871
ignore_binding,
871
872
) ;
872
873
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;
874
876
import. vis . set ( orig_vis) ;
875
877
let module = match path_res {
876
878
PathResult :: Module ( module) => {
0 commit comments