@@ -41,7 +41,7 @@ pub enum ImportDirectiveSubclass {
4141 type_determined : Cell < bool > ,
4242 value_determined : Cell < bool > ,
4343 } ,
44- GlobImport ,
44+ GlobImport { is_prelude : bool } ,
4545}
4646
4747impl ImportDirectiveSubclass {
@@ -64,7 +64,6 @@ pub struct ImportDirective<'a> {
6464 subclass : ImportDirectiveSubclass ,
6565 span : Span ,
6666 vis : ty:: Visibility , // see note in ImportResolutionPerNamespace about how to use this
67- is_prelude : bool ,
6867}
6968
7069impl < ' a > ImportDirective < ' a > {
@@ -84,7 +83,7 @@ impl<'a> ImportDirective<'a> {
8483 }
8584
8685 pub fn is_glob ( & self ) -> bool {
87- match self . subclass { ImportDirectiveSubclass :: GlobImport => true , _ => false }
86+ match self . subclass { ImportDirectiveSubclass :: GlobImport { .. } => true , _ => false }
8887 }
8988}
9089
@@ -191,7 +190,7 @@ impl<'a> NameResolution<'a> {
191190 } ;
192191 let name = match directive. subclass {
193192 SingleImport { source, .. } => source,
194- GlobImport => unreachable ! ( ) ,
193+ GlobImport { .. } => unreachable ! ( ) ,
195194 } ;
196195 match target_module. resolve_name ( name, ns, false ) {
197196 Failed ( _) => { }
@@ -282,16 +281,14 @@ impl<'a> ::ModuleS<'a> {
282281 subclass : ImportDirectiveSubclass ,
283282 span : Span ,
284283 id : NodeId ,
285- vis : ty:: Visibility ,
286- is_prelude : bool ) {
284+ vis : ty:: Visibility ) {
287285 let directive = self . arenas . alloc_import_directive ( ImportDirective {
288286 module_path : module_path,
289287 target_module : Cell :: new ( None ) ,
290288 subclass : subclass,
291289 span : span,
292290 id : id,
293291 vis : vis,
294- is_prelude : is_prelude,
295292 } ) ;
296293
297294 self . unresolved_imports . borrow_mut ( ) . push ( directive) ;
@@ -304,8 +301,8 @@ impl<'a> ::ModuleS<'a> {
304301 }
305302 // We don't add prelude imports to the globs since they only affect lexical scopes,
306303 // 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) ,
309306 }
310307 }
311308
@@ -496,7 +493,7 @@ impl<'a, 'b:'a, 'tcx:'b> ImportResolver<'a, 'b, 'tcx> {
496493 let ( source, target, value_determined, type_determined) = match directive. subclass {
497494 SingleImport { source, target, ref value_determined, ref type_determined } =>
498495 ( 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) ,
500497 } ;
501498
502499 // We need to resolve both namespaces for this to succeed.
@@ -644,7 +641,7 @@ impl<'a, 'b:'a, 'tcx:'b> ImportResolver<'a, 'b, 'tcx> {
644641 }
645642 self . resolver . populate_module_if_necessary ( target_module) ;
646643
647- if directive. is_prelude {
644+ if let GlobImport { is_prelude : true } = directive. subclass {
648645 * module_. prelude . borrow_mut ( ) = Some ( target_module) ;
649646 return Success ( ( ) ) ;
650647 }
@@ -747,7 +744,7 @@ fn import_path_to_string(names: &[Name], subclass: &ImportDirectiveSubclass) ->
747744fn import_directive_subclass_to_string ( subclass : & ImportDirectiveSubclass ) -> String {
748745 match * subclass {
749746 SingleImport { source, .. } => source. to_string ( ) ,
750- GlobImport => "*" . to_string ( ) ,
747+ GlobImport { .. } => "*" . to_string ( ) ,
751748 }
752749}
753750
0 commit comments