Skip to content

Commit

Permalink
Fix rebase
Browse files Browse the repository at this point in the history
  • Loading branch information
petrochenkov committed Sep 3, 2016
1 parent 0cb1938 commit 2dc2fc5
Showing 1 changed file with 32 additions and 1 deletion.
33 changes: 32 additions & 1 deletion src/librustc_metadata/encoder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1029,6 +1029,33 @@ impl<'a, 'tcx, 'encoder> ItemContentBuilder<'a, 'tcx, 'encoder> {
def_to_u64(ctor_did));
}
}
hir::ItemUnion(..) => {
let def = ecx.tcx.lookup_adt_def(def_id);
let variant = def.struct_variant();

encode_def_id_and_key(ecx, self.rbml_w, def_id);
encode_family(self.rbml_w, 'U');
self.encode_bounds_and_type_for_item(item.id);

encode_item_variances(self.rbml_w, ecx, item.id);
encode_name(self.rbml_w, item.name);
encode_attributes(self.rbml_w, &item.attrs);
encode_stability(self.rbml_w, stab);
encode_deprecation(self.rbml_w, depr);
self.encode_visibility(vis);
self.encode_repr_attrs(&item.attrs);

/* Encode def_ids for each field and method
for methods, write all the stuff get_trait_method
needs to know*/
self.encode_struct_fields(variant);

encode_inlined_item(ecx, self.rbml_w, InlinedItemRef::Item(def_id, item));
self.encode_mir(item.id);

// Encode inherent implementations for self union.
encode_inherent_implementations(ecx, self.rbml_w, def_id);
}
hir::ItemDefaultImpl(unsafety, _) => {
encode_def_id_and_key(ecx, self.rbml_w, def_id);
encode_family(self.rbml_w, 'd');
Expand Down Expand Up @@ -1180,7 +1207,7 @@ impl<'a, 'tcx, 'encoder> IndexBuilder<'a, 'tcx, 'encoder> {
self.encode_addl_struct_info(def_id, struct_def.id(), item);
}
hir::ItemUnion(..) => {
unimplemented_unions!();
self.encode_addl_union_info(def_id);
}
hir::ItemImpl(_, _, _, _, _, ref ast_items) => {
self.encode_addl_impl_info(def_id, item.id, ast_items);
Expand Down Expand Up @@ -1217,6 +1244,10 @@ impl<'a, 'tcx, 'encoder> IndexBuilder<'a, 'tcx, 'encoder> {
}
}

fn encode_addl_union_info(&mut self, def_id: DefId) {
self.encode_fields(def_id);
}

fn encode_addl_impl_info(&mut self,
def_id: DefId,
impl_id: ast::NodeId,
Expand Down

0 comments on commit 2dc2fc5

Please sign in to comment.