@@ -1806,6 +1806,7 @@ impl<'a> Resolver<'a> {
1806
1806
}
1807
1807
1808
1808
let kind = match def {
1809
+ DefTy ( _, true ) => EnumModuleKind ,
1809
1810
DefStruct ( ..) | DefTy ( ..) => ImplModuleKind ,
1810
1811
_ => NormalModuleKind
1811
1812
} ;
@@ -1840,6 +1841,7 @@ impl<'a> Resolver<'a> {
1840
1841
1841
1842
match def {
1842
1843
DefMod ( _) | DefForeignMod ( _) => { }
1844
+ // Still here for staging
1843
1845
DefVariant ( enum_did, variant_id, is_struct) => {
1844
1846
debug ! ( "(building reduced graph for external crate) building \
1845
1847
variant {}",
@@ -1905,6 +1907,35 @@ impl<'a> Resolver<'a> {
1905
1907
is_public,
1906
1908
DUMMY_SP )
1907
1909
}
1910
+ DefTy ( def_id, true ) => { // enums
1911
+ debug ! ( "(building reduced graph for external crate) building enum {}" , final_ident) ;
1912
+ child_name_bindings. define_type ( def, DUMMY_SP , is_public) ;
1913
+ let enum_module = ModuleReducedGraphParent ( child_name_bindings. get_module ( ) ) ;
1914
+
1915
+ let variants = csearch:: get_enum_variant_defs ( & self . session . cstore , def_id) ;
1916
+ for & ( v_def, name, vis) in variants. iter ( ) {
1917
+ let ( variant_id, is_struct) = match v_def {
1918
+ DefVariant ( _, variant_id, is_struct) => ( variant_id, is_struct) ,
1919
+ _ => unreachable ! ( )
1920
+ } ;
1921
+ let child = self . add_child ( name, enum_module. clone ( ) ,
1922
+ OverwriteDuplicates ,
1923
+ DUMMY_SP ) ;
1924
+
1925
+ // If this variant is public, then it was publicly reexported,
1926
+ // otherwise we need to inherit the visibility of the enum
1927
+ // definition.
1928
+ let variant_exported = vis == ast:: Public || is_exported;
1929
+ if is_struct {
1930
+ child. define_type ( v_def, DUMMY_SP , variant_exported) ;
1931
+ // Not adding fields for variants as they are not accessed with a self receiver
1932
+ self . structs . insert ( variant_id, Vec :: new ( ) ) ;
1933
+ } else {
1934
+ child. define_value ( v_def, DUMMY_SP , variant_exported) ;
1935
+ }
1936
+ }
1937
+
1938
+ }
1908
1939
DefTy ( ..) | DefAssociatedTy ( ..) => {
1909
1940
debug ! ( "(building reduced graph for external \
1910
1941
crate) building type {}", final_ident) ;
0 commit comments