@@ -1387,16 +1387,22 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
1387
1387
// This is not a crate-relative path. We resolve the
1388
1388
// first component of the path in the current lexical
1389
1389
// scope and then proceed to resolve below that.
1390
- match self . resolve_module_in_lexical_scope ( module_, module_path[ 0 ] ) {
1390
+ match self . resolve_item_in_lexical_scope ( module_,
1391
+ module_path[ 0 ] ,
1392
+ TypeNS ,
1393
+ true ) {
1391
1394
Failed ( err) => return Failed ( err) ,
1392
1395
Indeterminate => {
1393
1396
debug ! ( "(resolving module path for import) indeterminate; bailing" ) ;
1394
1397
return Indeterminate ;
1395
1398
}
1396
- Success ( containing_module) => {
1397
- search_module = containing_module;
1398
- start_index = 1 ;
1399
- last_private = LastMod ( AllPublic ) ;
1399
+ Success ( ( target, _) ) => match target. binding . module ( ) {
1400
+ Some ( containing_module) => {
1401
+ search_module = containing_module;
1402
+ start_index = 1 ;
1403
+ last_private = LastMod ( AllPublic ) ;
1404
+ }
1405
+ None => return Failed ( None ) ,
1400
1406
}
1401
1407
}
1402
1408
}
@@ -1477,35 +1483,6 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
1477
1483
}
1478
1484
}
1479
1485
1480
- /// Resolves a module name in the current lexical scope.
1481
- fn resolve_module_in_lexical_scope ( & mut self ,
1482
- module_ : Module < ' a > ,
1483
- name : Name )
1484
- -> ResolveResult < Module < ' a > > {
1485
- // If this module is an anonymous module, resolve the item in the
1486
- // lexical scope. Otherwise, resolve the item from the crate root.
1487
- let resolve_result = self . resolve_item_in_lexical_scope ( module_, name, TypeNS , true ) ;
1488
- match resolve_result {
1489
- Success ( ( target, _) ) => {
1490
- if let Some ( module_def) = target. binding . module ( ) {
1491
- return Success ( module_def)
1492
- } else {
1493
- debug ! ( "!!! (resolving module in lexical scope) module \
1494
- wasn't actually a module!") ;
1495
- return Failed ( None ) ;
1496
- }
1497
- }
1498
- Indeterminate => {
1499
- debug ! ( "(resolving module in lexical scope) indeterminate; bailing" ) ;
1500
- return Indeterminate ;
1501
- }
1502
- Failed ( err) => {
1503
- debug ! ( "(resolving module in lexical scope) failed to resolve" ) ;
1504
- return Failed ( err) ;
1505
- }
1506
- }
1507
- }
1508
-
1509
1486
/// Returns the nearest normal module parent of the given module.
1510
1487
fn get_nearest_normal_module_parent ( & mut self , module_ : Module < ' a > ) -> Option < Module < ' a > > {
1511
1488
let mut module_ = module_;
0 commit comments