]> git.lizzy.rs Git - rust.git/blobdiff - src/librustc/hir/lowering.rs
Auto merge of #35856 - phimuemue:master, r=brson
[rust.git] / src / librustc / hir / lowering.rs
index b45610c3fe820150bccc4f68a437991fc7887d7f..6739d3f662ac6f69dbe664be258138cde9a7f8e0 100644 (file)
@@ -218,16 +218,10 @@ fn lower_view_path(&mut self, view_path: &ViewPath) -> P<hir::ViewPath> {
 
     fn lower_path_list_item(&mut self, path_list_ident: &PathListItem) -> hir::PathListItem {
         Spanned {
-            node: match path_list_ident.node {
-                PathListItemKind::Ident { id, name, rename } => hir::PathListIdent {
-                    id: id,
-                    name: name.name,
-                    rename: rename.map(|x| x.name),
-                },
-                PathListItemKind::Mod { id, rename } => hir::PathListMod {
-                    id: id,
-                    rename: rename.map(|x| x.name),
-                },
+            node: hir::PathListItem_ {
+                id: path_list_ident.node.id,
+                name: path_list_ident.node.name.name,
+                rename: path_list_ident.node.rename.map(|rename| rename.name),
             },
             span: path_list_ident.span,
         }
@@ -466,6 +460,7 @@ fn lower_generics(&mut self, g: &Generics) -> hir::Generics {
             ty_params: self.lower_ty_params(&g.ty_params),
             lifetimes: self.lower_lifetime_defs(&g.lifetimes),
             where_clause: self.lower_where_clause(&g.where_clause),
+            span: g.span,
         }
     }
 
@@ -643,6 +638,7 @@ fn lower_item_kind(&mut self, i: &ItemKind) -> hir::Item_ {
                 let struct_def = self.lower_variant_data(struct_def);
                 hir::ItemStruct(struct_def, self.lower_generics(generics))
             }
+            ItemKind::Union(..) => panic!("`union` is not yet implemented"),
             ItemKind::DefaultImpl(unsafety, ref trait_ref) => {
                 hir::ItemDefaultImpl(self.lower_unsafety(unsafety),
                                      self.lower_trait_ref(trait_ref))
@@ -809,8 +805,8 @@ fn lower_unsafety(&mut self, u: Unsafety) -> hir::Unsafety {
         }
     }
 
-    fn lower_constness(&mut self, c: Constness) -> hir::Constness {
-        match c {
+    fn lower_constness(&mut self, c: Spanned<Constness>) -> hir::Constness {
+        match c.node {
             Constness::Const => hir::Constness::Const,
             Constness::NotConst => hir::Constness::NotConst,
         }