@@ -1243,7 +1243,7 @@ struct UseError<'a> {
1243
1243
#[ derive( Clone , Copy , PartialEq , Debug ) ]
1244
1244
enum AmbiguityKind {
1245
1245
Import ,
1246
- AbsolutePath ,
1246
+ // AbsolutePath,
1247
1247
BuiltinAttr ,
1248
1248
DeriveHelper ,
1249
1249
LegacyHelperVsPrelude ,
@@ -1259,8 +1259,8 @@ impl AmbiguityKind {
1259
1259
match self {
1260
1260
AmbiguityKind :: Import =>
1261
1261
"name vs any other name during import resolution" ,
1262
- AmbiguityKind :: AbsolutePath =>
1263
- "name in the crate root vs extern crate during absolute path resolution" ,
1262
+ // AmbiguityKind::AbsolutePath =>
1263
+ // "name in the crate root vs extern crate during absolute path resolution",
1264
1264
AmbiguityKind :: BuiltinAttr =>
1265
1265
"built-in attribute vs any other name" ,
1266
1266
AmbiguityKind :: DeriveHelper =>
@@ -1513,6 +1513,8 @@ pub struct Resolver<'a> {
1513
1513
/// FIXME: Refactor things so that these fields are passed through arguments and not resolver.
1514
1514
/// We are resolving a last import segment during import validation.
1515
1515
last_import_segment : bool ,
1516
+ /// We are resolving a prefix for `use *` or `use ::*` on 2015 edition.
1517
+ root_glob_import : bool ,
1516
1518
/// This binding should be ignored during in-module resolution, so that we don't get
1517
1519
/// "self-confirming" import resolutions during import validation.
1518
1520
blacklisted_binding : Option < & ' a NameBinding < ' a > > ,
@@ -1861,6 +1863,7 @@ impl<'a> Resolver<'a> {
1861
1863
current_self_type : None ,
1862
1864
current_self_item : None ,
1863
1865
last_import_segment : false ,
1866
+ root_glob_import : false ,
1864
1867
blacklisted_binding : None ,
1865
1868
1866
1869
primitive_type_table : PrimitiveTypeTable :: new ( ) ,
@@ -3833,19 +3836,17 @@ impl<'a> Resolver<'a> {
3833
3836
self . resolve_self ( & mut ctxt, self . current_module ) ) ) ;
3834
3837
continue ;
3835
3838
}
3836
- if name == keywords:: PathRoot . name ( ) && ident . span . rust_2018 ( ) {
3837
- module = Some ( ModuleOrUniformRoot :: ExternPrelude ) ;
3838
- continue ;
3839
- }
3840
- if name == keywords :: PathRoot . name ( ) &&
3841
- ident . span . rust_2015 ( ) && self . session . rust_2018 ( ) {
3842
- // `::a::b` from 2015 macro on 2018 global edition
3843
- module = Some ( ModuleOrUniformRoot :: CrateRootAndExternPrelude ) ;
3839
+ if name == keywords:: PathRoot . name ( ) {
3840
+ module = Some ( if ident . span . rust_2018 ( ) {
3841
+ ModuleOrUniformRoot :: ExternPrelude
3842
+ } else if ! self . root_glob_import {
3843
+ ModuleOrUniformRoot :: CrateRootAndExternPrelude
3844
+ } else {
3845
+ ModuleOrUniformRoot :: Module ( self . resolve_crate_root ( ident ) )
3846
+ } ) ;
3844
3847
continue ;
3845
3848
}
3846
- if name == keywords:: PathRoot . name ( ) ||
3847
- name == keywords:: Crate . name ( ) ||
3848
- name == keywords:: DollarCrate . name ( ) {
3849
+ if name == keywords:: Crate . name ( ) || name == keywords:: DollarCrate . name ( ) {
3849
3850
// `::a::b`, `crate::a::b` or `$crate::a::b`
3850
3851
module = Some ( ModuleOrUniformRoot :: Module (
3851
3852
self . resolve_crate_root ( ident) ) ) ;
0 commit comments