Skip to content

Commit 7e5d224

Browse files
csmoeoli-obk
authored andcommitted
ForeignItemKind
1 parent f12eca4 commit 7e5d224

File tree

18 files changed

+60
-61
lines changed

18 files changed

+60
-61
lines changed

src/librustc/hir/intravisit.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -710,15 +710,15 @@ pub fn walk_foreign_item<'v, V: Visitor<'v>>(visitor: &mut V, foreign_item: &'v
710710
visitor.visit_name(foreign_item.span, foreign_item.name);
711711

712712
match foreign_item.node {
713-
ForeignItemFn(ref function_declaration, ref param_names, ref generics) => {
713+
ForeignItemKind::Fn(ref function_declaration, ref param_names, ref generics) => {
714714
visitor.visit_generics(generics);
715715
visitor.visit_fn_decl(function_declaration);
716716
for &param_name in param_names {
717717
visitor.visit_ident(param_name);
718718
}
719719
}
720-
ForeignItemStatic(ref typ, _) => visitor.visit_ty(typ),
721-
ForeignItemType => (),
720+
ForeignItemKind::Static(ref typ, _) => visitor.visit_ty(typ),
721+
ForeignItemKind::Type => (),
722722
}
723723

724724
walk_list!(visitor, visit_attribute, &foreign_item.attrs);

src/librustc/hir/lowering.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3230,12 +3230,12 @@ impl<'a> LoweringContext<'a> {
32303230
},
32313231
);
32323232

3233-
hir::ForeignItemFn(fn_dec, fn_args, generics)
3233+
hir::ForeignItemKind::Fn(fn_dec, fn_args, generics)
32343234
}
32353235
ForeignItemKind::Static(ref t, m) => {
3236-
hir::ForeignItemStatic(self.lower_ty(t, ImplTraitContext::Disallowed), m)
3236+
hir::ForeignItemKind::Static(self.lower_ty(t, ImplTraitContext::Disallowed), m)
32373237
}
3238-
ForeignItemKind::Ty => hir::ForeignItemType,
3238+
ForeignItemKind::Ty => hir::ForeignItemKind::Type,
32393239
ForeignItemKind::Macro(_) => panic!("shouldn't exist here"),
32403240
},
32413241
vis: self.lower_visibility(&i.vis, None),

src/librustc/hir/map/mod.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -451,9 +451,9 @@ impl<'hir> Map<'hir> {
451451
NodeForeignItem(item) => {
452452
let def_id = self.local_def_id(item.id);
453453
match item.node {
454-
ForeignItemFn(..) => Some(Def::Fn(def_id)),
455-
ForeignItemStatic(_, m) => Some(Def::Static(def_id, m)),
456-
ForeignItemType => Some(Def::TyForeign(def_id)),
454+
ForeignItemKind::Fn(..) => Some(Def::Fn(def_id)),
455+
ForeignItemKind::Static(_, m) => Some(Def::Static(def_id, m)),
456+
ForeignItemKind::Type => Some(Def::TyForeign(def_id)),
457457
}
458458
}
459459
NodeTraitItem(item) => {

src/librustc/hir/mod.rs

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
pub use self::BlockCheckMode::*;
1414
pub use self::CaptureClause::*;
1515
pub use self::FunctionRetTy::*;
16-
pub use self::ForeignItem_::*;
1716
pub use self::Item_::*;
1817
pub use self::Mutability::*;
1918
pub use self::PrimTy::*;
@@ -2192,30 +2191,30 @@ pub enum AssociatedItemKind {
21922191
pub struct ForeignItem {
21932192
pub name: Name,
21942193
pub attrs: HirVec<Attribute>,
2195-
pub node: ForeignItem_,
2194+
pub node: ForeignItemKind,
21962195
pub id: NodeId,
21972196
pub span: Span,
21982197
pub vis: Visibility,
21992198
}
22002199

22012200
/// An item within an `extern` block
22022201
#[derive(Clone, RustcEncodable, RustcDecodable, Debug)]
2203-
pub enum ForeignItem_ {
2202+
pub enum ForeignItemKind {
22042203
/// A foreign function
2205-
ForeignItemFn(P<FnDecl>, HirVec<Ident>, Generics),
2204+
Fn(P<FnDecl>, HirVec<Ident>, Generics),
22062205
/// A foreign static item (`static ext: u8`), with optional mutability
22072206
/// (the boolean is true when mutable)
2208-
ForeignItemStatic(P<Ty>, bool),
2207+
Static(P<Ty>, bool),
22092208
/// A foreign type
2210-
ForeignItemType,
2209+
Type,
22112210
}
22122211

2213-
impl ForeignItem_ {
2212+
impl ForeignItemKind {
22142213
pub fn descriptive_variant(&self) -> &str {
22152214
match *self {
2216-
ForeignItemFn(..) => "foreign function",
2217-
ForeignItemStatic(..) => "foreign static item",
2218-
ForeignItemType => "foreign type",
2215+
ForeignItemKind::Fn(..) => "foreign function",
2216+
ForeignItemKind::Static(..) => "foreign static item",
2217+
ForeignItemKind::Type => "foreign type",
22192218
}
22202219
}
22212220
}

src/librustc/hir/print.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -447,7 +447,7 @@ impl<'a> State<'a> {
447447
self.maybe_print_comment(item.span.lo())?;
448448
self.print_outer_attributes(&item.attrs)?;
449449
match item.node {
450-
hir::ForeignItemFn(ref decl, ref arg_names, ref generics) => {
450+
hir::ForeignItemKind::Fn(ref decl, ref arg_names, ref generics) => {
451451
self.head("")?;
452452
self.print_fn(decl,
453453
hir::FnHeader {
@@ -465,7 +465,7 @@ impl<'a> State<'a> {
465465
self.s.word(";")?;
466466
self.end() // end the outer fn box
467467
}
468-
hir::ForeignItemStatic(ref t, m) => {
468+
hir::ForeignItemKind::Static(ref t, m) => {
469469
self.head(&visibility_qualified(&item.vis, "static"))?;
470470
if m {
471471
self.word_space("mut")?;
@@ -477,7 +477,7 @@ impl<'a> State<'a> {
477477
self.end()?; // end the head-ibox
478478
self.end() // end the outer cbox
479479
}
480-
hir::ForeignItemType => {
480+
hir::ForeignItemKind::Type => {
481481
self.head(&visibility_qualified(&item.vis, "type"))?;
482482
self.print_name(item.name)?;
483483
self.s.word(";")?;

src/librustc/ich/impls_hir.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -909,10 +909,10 @@ impl_stable_hash_for!(struct hir::ForeignItem {
909909
vis
910910
});
911911

912-
impl_stable_hash_for!(enum hir::ForeignItem_ {
913-
ForeignItemFn(fn_decl, arg_names, generics),
914-
ForeignItemStatic(ty, is_mutbl),
915-
ForeignItemType
912+
impl_stable_hash_for!(enum hir::ForeignItemKind {
913+
Fn(fn_decl, arg_names, generics),
914+
Static(ty, is_mutbl),
915+
Type
916916
});
917917

918918
impl_stable_hash_for!(enum hir::StmtKind {

src/librustc/middle/resolve_lifetime.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -550,15 +550,15 @@ impl<'a, 'tcx> Visitor<'tcx> for LifetimeContext<'a, 'tcx> {
550550

551551
fn visit_foreign_item(&mut self, item: &'tcx hir::ForeignItem) {
552552
match item.node {
553-
hir::ForeignItemFn(ref decl, _, ref generics) => {
553+
hir::ForeignItemKind::Fn(ref decl, _, ref generics) => {
554554
self.visit_early_late(None, decl, generics, |this| {
555555
intravisit::walk_foreign_item(this, item);
556556
})
557557
}
558-
hir::ForeignItemStatic(..) => {
558+
hir::ForeignItemKind::Static(..) => {
559559
intravisit::walk_foreign_item(self, item);
560560
}
561-
hir::ForeignItemType => {
561+
hir::ForeignItemKind::Type => {
562562
intravisit::walk_foreign_item(self, item);
563563
}
564564
}

src/librustc/ty/util.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -608,7 +608,7 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> {
608608
node: hir::ItemStatic(_, mutbl, _), ..
609609
}) => Some(mutbl),
610610
Node::NodeForeignItem(&hir::ForeignItem {
611-
node: hir::ForeignItemStatic(_, is_mutbl), ..
611+
node: hir::ForeignItemKind::Static(_, is_mutbl), ..
612612
}) =>
613613
Some(if is_mutbl {
614614
hir::Mutability::MutMutable

src/librustc_codegen_llvm/consts.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ pub fn get_static(cx: &CodegenCx, def_id: DefId) -> ValueRef {
143143
}
144144

145145
hir_map::NodeForeignItem(&hir::ForeignItem {
146-
ref attrs, span, node: hir::ForeignItemStatic(..), ..
146+
ref attrs, span, node: hir::ForeignItemKind::Static(..), ..
147147
}) => {
148148
let g = if let Some(linkage) = cx.tcx.codegen_fn_attrs(def_id).linkage {
149149
// If this is a static with a linkage specified, then we need to handle

src/librustc_lint/types.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -786,13 +786,13 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for ImproperCTypes {
786786
if nmod.abi != Abi::RustIntrinsic && nmod.abi != Abi::PlatformIntrinsic {
787787
for ni in &nmod.items {
788788
match ni.node {
789-
hir::ForeignItemFn(ref decl, _, _) => {
789+
hir::ForeignItemKind::Fn(ref decl, _, _) => {
790790
vis.check_foreign_fn(ni.id, decl);
791791
}
792-
hir::ForeignItemStatic(ref ty, _) => {
792+
hir::ForeignItemKind::Static(ref ty, _) => {
793793
vis.check_foreign_static(ni.id, ty.span);
794794
}
795-
hir::ForeignItemType => ()
795+
hir::ForeignItemKind::Type => ()
796796
}
797797
}
798798
}

0 commit comments

Comments
 (0)