about summary refs log tree commit diff
path: root/src/librustc/hir
diff options
context:
space:
mode:
authorcsmoe <35686186+csmoe@users.noreply.github.com>2018-07-11 22:56:44 +0800
committerOliver Schneider <github35764891676564198441@oli-obk.de>2018-07-16 15:09:17 +0200
commit7e5d22447264fe8cd5e89326f31bb6f0db3f885b (patch)
tree96387a6bfb48cdf6d0db36675da47d2037fd1b0b /src/librustc/hir
parentf12eca47e09dc0aa7420e51c090a22cd72f44159 (diff)
downloadrust-7e5d22447264fe8cd5e89326f31bb6f0db3f885b.tar.gz
rust-7e5d22447264fe8cd5e89326f31bb6f0db3f885b.zip
ForeignItemKind
Diffstat (limited to 'src/librustc/hir')
-rw-r--r--src/librustc/hir/intravisit.rs6
-rw-r--r--src/librustc/hir/lowering.rs6
-rw-r--r--src/librustc/hir/map/mod.rs6
-rw-r--r--src/librustc/hir/mod.rs19
-rw-r--r--src/librustc/hir/print.rs6
5 files changed, 21 insertions, 22 deletions
diff --git a/src/librustc/hir/intravisit.rs b/src/librustc/hir/intravisit.rs
index 8c97d5e74af..401beeb6d20 100644
--- a/src/librustc/hir/intravisit.rs
+++ b/src/librustc/hir/intravisit.rs
@@ -710,15 +710,15 @@ pub fn walk_foreign_item<'v, V: Visitor<'v>>(visitor: &mut V, foreign_item: &'v
     visitor.visit_name(foreign_item.span, foreign_item.name);
 
     match foreign_item.node {
-        ForeignItemFn(ref function_declaration, ref param_names, ref generics) => {
+        ForeignItemKind::Fn(ref function_declaration, ref param_names, ref generics) => {
             visitor.visit_generics(generics);
             visitor.visit_fn_decl(function_declaration);
             for &param_name in param_names {
                 visitor.visit_ident(param_name);
             }
         }
-        ForeignItemStatic(ref typ, _) => visitor.visit_ty(typ),
-        ForeignItemType => (),
+        ForeignItemKind::Static(ref typ, _) => visitor.visit_ty(typ),
+        ForeignItemKind::Type => (),
     }
 
     walk_list!(visitor, visit_attribute, &foreign_item.attrs);
diff --git a/src/librustc/hir/lowering.rs b/src/librustc/hir/lowering.rs
index 060f0e036b6..d1cc061fdfd 100644
--- a/src/librustc/hir/lowering.rs
+++ b/src/librustc/hir/lowering.rs
@@ -3230,12 +3230,12 @@ impl<'a> LoweringContext<'a> {
                         },
                     );
 
-                    hir::ForeignItemFn(fn_dec, fn_args, generics)
+                    hir::ForeignItemKind::Fn(fn_dec, fn_args, generics)
                 }
                 ForeignItemKind::Static(ref t, m) => {
-                    hir::ForeignItemStatic(self.lower_ty(t, ImplTraitContext::Disallowed), m)
+                    hir::ForeignItemKind::Static(self.lower_ty(t, ImplTraitContext::Disallowed), m)
                 }
-                ForeignItemKind::Ty => hir::ForeignItemType,
+                ForeignItemKind::Ty => hir::ForeignItemKind::Type,
                 ForeignItemKind::Macro(_) => panic!("shouldn't exist here"),
             },
             vis: self.lower_visibility(&i.vis, None),
diff --git a/src/librustc/hir/map/mod.rs b/src/librustc/hir/map/mod.rs
index 3397c7b8432..d9ee77dbe24 100644
--- a/src/librustc/hir/map/mod.rs
+++ b/src/librustc/hir/map/mod.rs
@@ -451,9 +451,9 @@ impl<'hir> Map<'hir> {
             NodeForeignItem(item) => {
                 let def_id = self.local_def_id(item.id);
                 match item.node {
-                    ForeignItemFn(..) => Some(Def::Fn(def_id)),
-                    ForeignItemStatic(_, m) => Some(Def::Static(def_id, m)),
-                    ForeignItemType => Some(Def::TyForeign(def_id)),
+                    ForeignItemKind::Fn(..) => Some(Def::Fn(def_id)),
+                    ForeignItemKind::Static(_, m) => Some(Def::Static(def_id, m)),
+                    ForeignItemKind::Type => Some(Def::TyForeign(def_id)),
                 }
             }
             NodeTraitItem(item) => {
diff --git a/src/librustc/hir/mod.rs b/src/librustc/hir/mod.rs
index edacada9be4..ac7a9b4257a 100644
--- a/src/librustc/hir/mod.rs
+++ b/src/librustc/hir/mod.rs
@@ -13,7 +13,6 @@
 pub use self::BlockCheckMode::*;
 pub use self::CaptureClause::*;
 pub use self::FunctionRetTy::*;
-pub use self::ForeignItem_::*;
 pub use self::Item_::*;
 pub use self::Mutability::*;
 pub use self::PrimTy::*;
@@ -2192,7 +2191,7 @@ pub enum AssociatedItemKind {
 pub struct ForeignItem {
     pub name: Name,
     pub attrs: HirVec<Attribute>,
-    pub node: ForeignItem_,
+    pub node: ForeignItemKind,
     pub id: NodeId,
     pub span: Span,
     pub vis: Visibility,
@@ -2200,22 +2199,22 @@ pub struct ForeignItem {
 
 /// An item within an `extern` block
 #[derive(Clone, RustcEncodable, RustcDecodable, Debug)]
-pub enum ForeignItem_ {
+pub enum ForeignItemKind {
     /// A foreign function
-    ForeignItemFn(P<FnDecl>, HirVec<Ident>, Generics),
+    Fn(P<FnDecl>, HirVec<Ident>, Generics),
     /// A foreign static item (`static ext: u8`), with optional mutability
     /// (the boolean is true when mutable)
-    ForeignItemStatic(P<Ty>, bool),
+    Static(P<Ty>, bool),
     /// A foreign type
-    ForeignItemType,
+    Type,
 }
 
-impl ForeignItem_ {
+impl ForeignItemKind {
     pub fn descriptive_variant(&self) -> &str {
         match *self {
-            ForeignItemFn(..) => "foreign function",
-            ForeignItemStatic(..) => "foreign static item",
-            ForeignItemType => "foreign type",
+            ForeignItemKind::Fn(..) => "foreign function",
+            ForeignItemKind::Static(..) => "foreign static item",
+            ForeignItemKind::Type => "foreign type",
         }
     }
 }
diff --git a/src/librustc/hir/print.rs b/src/librustc/hir/print.rs
index 5c1378fd941..9d211535063 100644
--- a/src/librustc/hir/print.rs
+++ b/src/librustc/hir/print.rs
@@ -447,7 +447,7 @@ impl<'a> State<'a> {
         self.maybe_print_comment(item.span.lo())?;
         self.print_outer_attributes(&item.attrs)?;
         match item.node {
-            hir::ForeignItemFn(ref decl, ref arg_names, ref generics) => {
+            hir::ForeignItemKind::Fn(ref decl, ref arg_names, ref generics) => {
                 self.head("")?;
                 self.print_fn(decl,
                               hir::FnHeader {
@@ -465,7 +465,7 @@ impl<'a> State<'a> {
                 self.s.word(";")?;
                 self.end() // end the outer fn box
             }
-            hir::ForeignItemStatic(ref t, m) => {
+            hir::ForeignItemKind::Static(ref t, m) => {
                 self.head(&visibility_qualified(&item.vis, "static"))?;
                 if m {
                     self.word_space("mut")?;
@@ -477,7 +477,7 @@ impl<'a> State<'a> {
                 self.end()?; // end the head-ibox
                 self.end() // end the outer cbox
             }
-            hir::ForeignItemType => {
+            hir::ForeignItemKind::Type => {
                 self.head(&visibility_qualified(&item.vis, "type"))?;
                 self.print_name(item.name)?;
                 self.s.word(";")?;