about summary refs log tree commit diff
path: root/src/librustc_metadata/decoder.rs
diff options
context:
space:
mode:
authorIsaac Whitfield <iw@whitfin.io>2018-05-12 10:20:53 -0700
committerIsaac Whitfield <iw@whitfin.io>2018-05-18 09:37:29 -0700
commit680f3b24ba9b9e6dbf9301fe4af09a12fe8bb9cb (patch)
tree105f3c791d2d02b6f73c73438bc11286b9655208 /src/librustc_metadata/decoder.rs
parentca60c404b622c4e65db2d0171ef45c42635316bf (diff)
downloadrust-680f3b24ba9b9e6dbf9301fe4af09a12fe8bb9cb.tar.gz
rust-680f3b24ba9b9e6dbf9301fe4af09a12fe8bb9cb.zip
Serialize attributes into the CrateRoot
Diffstat (limited to 'src/librustc_metadata/decoder.rs')
-rw-r--r--src/librustc_metadata/decoder.rs16
1 files changed, 6 insertions, 10 deletions
diff --git a/src/librustc_metadata/decoder.rs b/src/librustc_metadata/decoder.rs
index 9a15b2dce04..8af4649ed5f 100644
--- a/src/librustc_metadata/decoder.rs
+++ b/src/librustc_metadata/decoder.rs
@@ -557,12 +557,14 @@ impl<'a, 'tcx> CrateMetadata {
                        -> &'tcx ty::AdtDef {
         let item = self.entry(item_id);
         let did = self.local_def_id(item_id);
-        let kind = match item.kind {
-            EntryKind::Enum(_) => ty::AdtKind::Enum,
-            EntryKind::Struct(_, _) => ty::AdtKind::Struct,
-            EntryKind::Union(_, _) => ty::AdtKind::Union,
+
+        let (kind, repr) = match item.kind {
+            EntryKind::Enum(repr) => (ty::AdtKind::Enum, repr),
+            EntryKind::Struct(_, repr) => (ty::AdtKind::Struct, repr),
+            EntryKind::Union(_, repr) => (ty::AdtKind::Union, repr),
             _ => bug!("get_adt_def called on a non-ADT {:?}", did),
         };
+
         let variants = if let ty::AdtKind::Enum = kind {
             item.children
                 .decode(self)
@@ -573,12 +575,6 @@ impl<'a, 'tcx> CrateMetadata {
         } else {
             vec![self.get_variant(&item, item_id)]
         };
-        let (kind, repr) = match item.kind {
-            EntryKind::Enum(repr) => (ty::AdtKind::Enum, repr),
-            EntryKind::Struct(_, repr) => (ty::AdtKind::Struct, repr),
-            EntryKind::Union(_, repr) => (ty::AdtKind::Union, repr),
-            _ => bug!("get_adt_def called on a non-ADT {:?}", did),
-        };
 
         tcx.alloc_adt_def(did, kind, variants, repr)
     }