@@ -41,7 +41,7 @@ pub enum ImportDirectiveSubclass {
41
41
type_determined : Cell < bool > ,
42
42
value_determined : Cell < bool > ,
43
43
} ,
44
- GlobImport ,
44
+ GlobImport { is_prelude : bool } ,
45
45
}
46
46
47
47
impl ImportDirectiveSubclass {
@@ -64,7 +64,6 @@ pub struct ImportDirective<'a> {
64
64
subclass : ImportDirectiveSubclass ,
65
65
span : Span ,
66
66
vis : ty:: Visibility , // see note in ImportResolutionPerNamespace about how to use this
67
- is_prelude : bool ,
68
67
}
69
68
70
69
impl < ' a > ImportDirective < ' a > {
@@ -84,7 +83,7 @@ impl<'a> ImportDirective<'a> {
84
83
}
85
84
86
85
pub fn is_glob ( & self ) -> bool {
87
- match self . subclass { ImportDirectiveSubclass :: GlobImport => true , _ => false }
86
+ match self . subclass { ImportDirectiveSubclass :: GlobImport { .. } => true , _ => false }
88
87
}
89
88
}
90
89
@@ -191,7 +190,7 @@ impl<'a> NameResolution<'a> {
191
190
} ;
192
191
let name = match directive. subclass {
193
192
SingleImport { source, .. } => source,
194
- GlobImport => unreachable ! ( ) ,
193
+ GlobImport { .. } => unreachable ! ( ) ,
195
194
} ;
196
195
match target_module. resolve_name ( name, ns, false ) {
197
196
Failed ( _) => { }
@@ -282,16 +281,14 @@ impl<'a> ::ModuleS<'a> {
282
281
subclass : ImportDirectiveSubclass ,
283
282
span : Span ,
284
283
id : NodeId ,
285
- vis : ty:: Visibility ,
286
- is_prelude : bool ) {
284
+ vis : ty:: Visibility ) {
287
285
let directive = self . arenas . alloc_import_directive ( ImportDirective {
288
286
module_path : module_path,
289
287
target_module : Cell :: new ( None ) ,
290
288
subclass : subclass,
291
289
span : span,
292
290
id : id,
293
291
vis : vis,
294
- is_prelude : is_prelude,
295
292
} ) ;
296
293
297
294
self . unresolved_imports . borrow_mut ( ) . push ( directive) ;
@@ -304,8 +301,8 @@ impl<'a> ::ModuleS<'a> {
304
301
}
305
302
// We don't add prelude imports to the globs since they only affect lexical scopes,
306
303
// which are not relevant to import resolution.
307
- GlobImport if directive . is_prelude => { }
308
- GlobImport => self . globs . borrow_mut ( ) . push ( directive) ,
304
+ GlobImport { is_prelude : true } => { }
305
+ GlobImport { .. } => self . globs . borrow_mut ( ) . push ( directive) ,
309
306
}
310
307
}
311
308
@@ -496,7 +493,7 @@ impl<'a, 'b:'a, 'tcx:'b> ImportResolver<'a, 'b, 'tcx> {
496
493
let ( source, target, value_determined, type_determined) = match directive. subclass {
497
494
SingleImport { source, target, ref value_determined, ref type_determined } =>
498
495
( source, target, value_determined, type_determined) ,
499
- GlobImport => return self . resolve_glob_import ( target_module, directive) ,
496
+ GlobImport { .. } => return self . resolve_glob_import ( target_module, directive) ,
500
497
} ;
501
498
502
499
// We need to resolve both namespaces for this to succeed.
@@ -644,7 +641,7 @@ impl<'a, 'b:'a, 'tcx:'b> ImportResolver<'a, 'b, 'tcx> {
644
641
}
645
642
self . resolver . populate_module_if_necessary ( target_module) ;
646
643
647
- if directive. is_prelude {
644
+ if let GlobImport { is_prelude : true } = directive. subclass {
648
645
* module_. prelude . borrow_mut ( ) = Some ( target_module) ;
649
646
return Success ( ( ) ) ;
650
647
}
@@ -747,7 +744,7 @@ fn import_path_to_string(names: &[Name], subclass: &ImportDirectiveSubclass) ->
747
744
fn import_directive_subclass_to_string ( subclass : & ImportDirectiveSubclass ) -> String {
748
745
match * subclass {
749
746
SingleImport { source, .. } => source. to_string ( ) ,
750
- GlobImport => "*" . to_string ( ) ,
747
+ GlobImport { .. } => "*" . to_string ( ) ,
751
748
}
752
749
}
753
750
0 commit comments