@@ -475,15 +475,15 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
475
475
let indeterminate_imports = mem:: take ( & mut self . indeterminate_imports ) ;
476
476
477
477
for ( is_indeterminate, import) in determined_imports
478
- . into_iter ( )
478
+ . iter ( )
479
479
. map ( |i| ( false , i) )
480
- . chain ( indeterminate_imports. into_iter ( ) . map ( |i| ( true , i) ) )
480
+ . chain ( indeterminate_imports. iter ( ) . map ( |i| ( true , i) ) )
481
481
{
482
- let unresolved_import_error = self . finalize_import ( import) ;
482
+ let unresolved_import_error = self . finalize_import ( * import) ;
483
483
484
484
// If this import is unresolved then create a dummy import
485
485
// resolution for it so that later resolve stages won't complain.
486
- self . import_dummy_binding ( import, is_indeterminate) ;
486
+ self . import_dummy_binding ( * import, is_indeterminate) ;
487
487
488
488
if let Some ( err) = unresolved_import_error {
489
489
if let ImportKind :: Single { source, ref source_bindings, .. } = import. kind {
@@ -505,27 +505,34 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
505
505
errors = vec ! [ ] ;
506
506
}
507
507
if seen_spans. insert ( err. span ) {
508
- errors. push ( ( import, err) ) ;
508
+ errors. push ( ( * import, err) ) ;
509
509
prev_root_id = import. root_id ;
510
510
}
511
- } else if is_indeterminate {
512
- let path = import_path_to_string (
513
- & import. module_path . iter ( ) . map ( |seg| seg. ident ) . collect :: < Vec < _ > > ( ) ,
514
- & import. kind ,
515
- import. span ,
516
- ) ;
517
- let err = UnresolvedImportError {
518
- span : import. span ,
519
- label : None ,
520
- note : None ,
521
- suggestion : None ,
522
- candidates : None ,
523
- } ;
524
- // FIXME: there should be a better way of doing this than
525
- // formatting this as a string then checking for `::`
526
- if path. contains ( "::" ) {
527
- errors. push ( ( import, err) )
528
- }
511
+ }
512
+ }
513
+
514
+ if !errors. is_empty ( ) {
515
+ self . throw_unresolved_import_error ( errors) ;
516
+ return ;
517
+ }
518
+
519
+ for import in & indeterminate_imports {
520
+ let path = import_path_to_string (
521
+ & import. module_path . iter ( ) . map ( |seg| seg. ident ) . collect :: < Vec < _ > > ( ) ,
522
+ & import. kind ,
523
+ import. span ,
524
+ ) ;
525
+ let err = UnresolvedImportError {
526
+ span : import. span ,
527
+ label : None ,
528
+ note : None ,
529
+ suggestion : None ,
530
+ candidates : None ,
531
+ } ;
532
+ // FIXME: there should be a better way of doing this than
533
+ // formatting this as a string then checking for `::`
534
+ if path. contains ( "::" ) {
535
+ errors. push ( ( * import, err) )
529
536
}
530
537
}
531
538
0 commit comments