@@ -397,7 +397,7 @@ impl<'a, 'b:'a, 'tcx:'b> ImportResolver<'a, 'b, 'tcx> {
397
397
:: std:: mem:: swap ( & mut imports, & mut unresolved_imports) ;
398
398
399
399
for import_directive in imports {
400
- match self . resolve_import_for_module ( & import_directive) {
400
+ match self . resolve_import ( & import_directive) {
401
401
Failed ( err) => {
402
402
let ( span, help) = match err {
403
403
Some ( ( span, msg) ) => ( span, format ! ( ". {}" , msg) ) ,
@@ -411,7 +411,11 @@ impl<'a, 'b:'a, 'tcx:'b> ImportResolver<'a, 'b, 'tcx> {
411
411
} ) ;
412
412
}
413
413
Indeterminate => unresolved_imports. push ( import_directive) ,
414
- Success ( ( ) ) => { }
414
+ Success ( ( ) ) => {
415
+ // Decrement the count of unresolved imports.
416
+ assert ! ( self . resolver. unresolved_imports >= 1 ) ;
417
+ self . resolver . unresolved_imports -= 1 ;
418
+ }
415
419
}
416
420
}
417
421
}
@@ -421,25 +425,19 @@ impl<'a, 'b:'a, 'tcx:'b> ImportResolver<'a, 'b, 'tcx> {
421
425
/// don't know whether the name exists at the moment due to other
422
426
/// currently-unresolved imports, or success if we know the name exists.
423
427
/// If successful, the resolved bindings are written into the module.
424
- fn resolve_import_for_module ( & mut self , directive : & ' b ImportDirective ) -> ResolveResult < ( ) > {
428
+ fn resolve_import ( & mut self , directive : & ' b ImportDirective ) -> ResolveResult < ( ) > {
425
429
debug ! ( "(resolving import for module) resolving import `{}::...` in `{}`" ,
426
430
names_to_string( & directive. module_path) ,
427
431
module_to_string( self . resolver. current_module) ) ;
428
432
429
- self . resolver
430
- . resolve_module_path ( & directive. module_path , DontUseLexicalScope , directive. span )
431
- // Once we have the module that contains the target, we can resolve the import.
432
- . and_then ( |containing_module| self . resolve_import ( containing_module, directive) )
433
- . and_then ( |( ) | {
434
- // Decrement the count of unresolved imports.
435
- assert ! ( self . resolver. unresolved_imports >= 1 ) ;
436
- self . resolver . unresolved_imports -= 1 ;
437
- Success ( ( ) )
438
- } )
439
- }
433
+ let target_module = match self . resolver . resolve_module_path ( & directive. module_path ,
434
+ DontUseLexicalScope ,
435
+ directive. span ) {
436
+ Success ( module) => module,
437
+ Indeterminate => return Indeterminate ,
438
+ Failed ( err) => return Failed ( err) ,
439
+ } ;
440
440
441
- fn resolve_import ( & mut self , target_module : Module < ' b > , directive : & ' b ImportDirective )
442
- -> ResolveResult < ( ) > {
443
441
let ( source, target, value_determined, type_determined) = match directive. subclass {
444
442
SingleImport { source, target, ref value_determined, ref type_determined } =>
445
443
( source, target, value_determined, type_determined) ,
0 commit comments