@@ -510,9 +510,9 @@ impl<'a, 'b:'a, 'tcx:'b> GraphBuilder<'a, 'b, 'tcx> {
510
510
self . structs . insert ( variant_def_id, Vec :: new ( ) ) ;
511
511
}
512
512
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.
513
515
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
516
516
child. define_value ( Def :: Variant ( item_id, self . ast_map . local_def_id ( variant. node . data . id ( ) ) ) ,
517
517
variant. span ,
518
518
DefModifiers :: PUBLIC | DefModifiers :: IMPORTABLE | variant_modifiers) ;
@@ -618,15 +618,14 @@ impl<'a, 'b:'a, 'tcx:'b> GraphBuilder<'a, 'b, 'tcx> {
618
618
Def :: Variant ( _, variant_id) => {
619
619
debug ! ( "(building reduced graph for external crate) building variant {}" ,
620
620
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.
623
623
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) ;
624
626
if self . session . cstore . variant_kind ( variant_id) == Some ( VariantKind :: Struct ) {
625
- child_name_bindings. define_type ( def, DUMMY_SP , modifiers) ;
626
627
// Not adding fields for variants as they are not accessed with a self receiver
627
628
self . structs . insert ( variant_id, Vec :: new ( ) ) ;
628
- } else {
629
- child_name_bindings. define_value ( def, DUMMY_SP , modifiers) ;
630
629
}
631
630
}
632
631
Def :: Fn ( ..) |
0 commit comments