@@ -1029,6 +1029,33 @@ impl<'a, 'tcx, 'encoder> ItemContentBuilder<'a, 'tcx, 'encoder> {
1029
1029
def_to_u64 ( ctor_did) ) ;
1030
1030
}
1031
1031
}
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
+ }
1032
1059
hir:: ItemDefaultImpl ( unsafety, _) => {
1033
1060
encode_def_id_and_key ( ecx, self . rbml_w , def_id) ;
1034
1061
encode_family ( self . rbml_w , 'd' ) ;
@@ -1180,7 +1207,7 @@ impl<'a, 'tcx, 'encoder> IndexBuilder<'a, 'tcx, 'encoder> {
1180
1207
self . encode_addl_struct_info ( def_id, struct_def. id ( ) , item) ;
1181
1208
}
1182
1209
hir:: ItemUnion ( ..) => {
1183
- unimplemented_unions ! ( ) ;
1210
+ self . encode_addl_union_info ( def_id ) ;
1184
1211
}
1185
1212
hir:: ItemImpl ( _, _, _, _, _, ref ast_items) => {
1186
1213
self . encode_addl_impl_info ( def_id, item. id , ast_items) ;
@@ -1217,6 +1244,10 @@ impl<'a, 'tcx, 'encoder> IndexBuilder<'a, 'tcx, 'encoder> {
1217
1244
}
1218
1245
}
1219
1246
1247
+ fn encode_addl_union_info ( & mut self , def_id : DefId ) {
1248
+ self . encode_fields ( def_id) ;
1249
+ }
1250
+
1220
1251
fn encode_addl_impl_info ( & mut self ,
1221
1252
def_id : DefId ,
1222
1253
impl_id : ast:: NodeId ,
0 commit comments