@@ -510,9 +510,9 @@ impl<'a, 'b:'a, 'tcx:'b> GraphBuilder<'a, 'b, 'tcx> {
510510 self . structs . insert ( variant_def_id, Vec :: new ( ) ) ;
511511 }
512512
513+ // Variants are always treated as importable to allow them to be glob used.
514+ // All variants are defined in both type and value namespaces as future-proofing.
513515 let child = self . add_child ( name, parent, ForbidDuplicateTypesAndValues , variant. span ) ;
514- // variants are always treated as importable to allow them to be glob
515- // used
516516 child. define_value ( Def :: Variant ( item_id, self . ast_map . local_def_id ( variant. node . data . id ( ) ) ) ,
517517 variant. span ,
518518 DefModifiers :: PUBLIC | DefModifiers :: IMPORTABLE | variant_modifiers) ;
@@ -618,15 +618,14 @@ impl<'a, 'b:'a, 'tcx:'b> GraphBuilder<'a, 'b, 'tcx> {
618618 Def :: Variant ( _, variant_id) => {
619619 debug ! ( "(building reduced graph for external crate) building variant {}" ,
620620 final_ident) ;
621- // variants are always treated as importable to allow them to be
622- // glob used
621+ // Variants are always treated as importable to allow them to be glob used.
622+ // All variants are defined in both type and value namespaces as future-proofing.
623623 let modifiers = DefModifiers :: PUBLIC | DefModifiers :: IMPORTABLE ;
624+ child_name_bindings. define_type ( def, DUMMY_SP , modifiers) ;
625+ child_name_bindings. define_value ( def, DUMMY_SP , modifiers) ;
624626 if self . session . cstore . variant_kind ( variant_id) == Some ( VariantKind :: Struct ) {
625- child_name_bindings. define_type ( def, DUMMY_SP , modifiers) ;
626627 // Not adding fields for variants as they are not accessed with a self receiver
627628 self . structs . insert ( variant_id, Vec :: new ( ) ) ;
628- } else {
629- child_name_bindings. define_value ( def, DUMMY_SP , modifiers) ;
630629 }
631630 }
632631 Def :: Fn ( ..) |
0 commit comments