@@ -1029,6 +1029,33 @@ impl<'a, 'tcx, 'encoder> ItemContentBuilder<'a, 'tcx, 'encoder> {
10291029 def_to_u64 ( ctor_did) ) ;
10301030 }
10311031 }
1032+ hir:: ItemUnion ( ..) => {
1033+ let def = ecx. tcx . lookup_adt_def ( def_id) ;
1034+ let variant = def. struct_variant ( ) ;
1035+
1036+ encode_def_id_and_key ( ecx, self . rbml_w , def_id) ;
1037+ encode_family ( self . rbml_w , 'U' ) ;
1038+ self . encode_bounds_and_type_for_item ( item. id ) ;
1039+
1040+ encode_item_variances ( self . rbml_w , ecx, item. id ) ;
1041+ encode_name ( self . rbml_w , item. name ) ;
1042+ encode_attributes ( self . rbml_w , & item. attrs ) ;
1043+ encode_stability ( self . rbml_w , stab) ;
1044+ encode_deprecation ( self . rbml_w , depr) ;
1045+ self . encode_visibility ( vis) ;
1046+ self . encode_repr_attrs ( & item. attrs ) ;
1047+
1048+ /* Encode def_ids for each field and method
1049+ for methods, write all the stuff get_trait_method
1050+ needs to know*/
1051+ self . encode_struct_fields ( variant) ;
1052+
1053+ encode_inlined_item ( ecx, self . rbml_w , InlinedItemRef :: Item ( def_id, item) ) ;
1054+ self . encode_mir ( item. id ) ;
1055+
1056+ // Encode inherent implementations for self union.
1057+ encode_inherent_implementations ( ecx, self . rbml_w , def_id) ;
1058+ }
10321059 hir:: ItemDefaultImpl ( unsafety, _) => {
10331060 encode_def_id_and_key ( ecx, self . rbml_w , def_id) ;
10341061 encode_family ( self . rbml_w , 'd' ) ;
@@ -1180,7 +1207,7 @@ impl<'a, 'tcx, 'encoder> IndexBuilder<'a, 'tcx, 'encoder> {
11801207 self . encode_addl_struct_info ( def_id, struct_def. id ( ) , item) ;
11811208 }
11821209 hir:: ItemUnion ( ..) => {
1183- unimplemented_unions ! ( ) ;
1210+ self . encode_addl_union_info ( def_id ) ;
11841211 }
11851212 hir:: ItemImpl ( _, _, _, _, _, ref ast_items) => {
11861213 self . encode_addl_impl_info ( def_id, item. id , ast_items) ;
@@ -1217,6 +1244,10 @@ impl<'a, 'tcx, 'encoder> IndexBuilder<'a, 'tcx, 'encoder> {
12171244 }
12181245 }
12191246
1247+ fn encode_addl_union_info ( & mut self , def_id : DefId ) {
1248+ self . encode_fields ( def_id) ;
1249+ }
1250+
12201251 fn encode_addl_impl_info ( & mut self ,
12211252 def_id : DefId ,
12221253 impl_id : ast:: NodeId ,
0 commit comments