Skip to content

Commit 0d6ddd1

Browse files
committed
[breaking-change] don't glob export ast::ForeignItem_ variants
1 parent 8290c95 commit 0d6ddd1

File tree

6 files changed

+20
-21
lines changed

6 files changed

+20
-21
lines changed

src/librustc_front/lowering.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -838,10 +838,10 @@ pub fn lower_foreign_item(lctx: &LoweringContext, i: &ForeignItem) -> hir::Forei
838838
name: i.ident.name,
839839
attrs: lower_attrs(lctx, &i.attrs),
840840
node: match i.node {
841-
ForeignItemFn(ref fdec, ref generics) => {
841+
ForeignItemKind::Fn(ref fdec, ref generics) => {
842842
hir::ForeignItemFn(lower_fn_decl(lctx, fdec), lower_generics(lctx, generics))
843843
}
844-
ForeignItemStatic(ref t, m) => {
844+
ForeignItemKind::Static(ref t, m) => {
845845
hir::ForeignItemStatic(lower_ty(lctx, t), m)
846846
}
847847
},

src/libsyntax/ast.rs

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010

1111
// The Rust abstract syntax tree.
1212

13-
pub use self::ForeignItem_::*;
1413
pub use self::Item_::*;
1514
pub use self::KleeneOp::*;
1615
pub use self::MacStmtStyle::*;
@@ -2039,27 +2038,27 @@ impl Item_ {
20392038
pub struct ForeignItem {
20402039
pub ident: Ident,
20412040
pub attrs: Vec<Attribute>,
2042-
pub node: ForeignItem_,
2041+
pub node: ForeignItemKind,
20432042
pub id: NodeId,
20442043
pub span: Span,
20452044
pub vis: Visibility,
20462045
}
20472046

20482047
/// An item within an `extern` block
20492048
#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug)]
2050-
pub enum ForeignItem_ {
2049+
pub enum ForeignItemKind {
20512050
/// A foreign function
2052-
ForeignItemFn(P<FnDecl>, Generics),
2051+
Fn(P<FnDecl>, Generics),
20532052
/// A foreign static item (`static ext: u8`), with optional mutability
20542053
/// (the boolean is true when mutable)
2055-
ForeignItemStatic(P<Ty>, bool),
2054+
Static(P<Ty>, bool),
20562055
}
20572056

2058-
impl ForeignItem_ {
2057+
impl ForeignItemKind {
20592058
pub fn descriptive_variant(&self) -> &str {
20602059
match *self {
2061-
ForeignItemFn(..) => "foreign function",
2062-
ForeignItemStatic(..) => "foreign static item"
2060+
ForeignItemKind::Fn(..) => "foreign function",
2061+
ForeignItemKind::Static(..) => "foreign static item"
20632062
}
20642063
}
20652064
}

src/libsyntax/fold.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1092,11 +1092,11 @@ pub fn noop_fold_foreign_item<T: Folder>(ni: P<ForeignItem>, folder: &mut T) ->
10921092
ident: folder.fold_ident(ident),
10931093
attrs: fold_attrs(attrs, folder),
10941094
node: match node {
1095-
ForeignItemFn(fdec, generics) => {
1096-
ForeignItemFn(folder.fold_fn_decl(fdec), folder.fold_generics(generics))
1095+
ForeignItemKind::Fn(fdec, generics) => {
1096+
ForeignItemKind::Fn(folder.fold_fn_decl(fdec), folder.fold_generics(generics))
10971097
}
1098-
ForeignItemStatic(t, m) => {
1099-
ForeignItemStatic(folder.fold_ty(t), m)
1098+
ForeignItemKind::Static(t, m) => {
1099+
ForeignItemKind::Static(folder.fold_ty(t), m)
11001100
}
11011101
},
11021102
vis: vis,

src/libsyntax/parse/parser.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ use ast::{Decl, DeclKind};
2222
use ast::{EMPTY_CTXT, EnumDef, ExplicitSelf};
2323
use ast::{Expr, ExprKind};
2424
use ast::{Field, FnDecl};
25-
use ast::{ForeignItem, ForeignItemStatic, ForeignItemFn, FunctionRetTy};
25+
use ast::{ForeignItem, ForeignItemKind, FunctionRetTy};
2626
use ast::{Ident, Inherited, ImplItem, Item, Item_, ItemStatic};
2727
use ast::{ItemEnum, ItemFn, ItemForeignMod, ItemImpl, ItemConst};
2828
use ast::{ItemMac, ItemMod, ItemStruct, ItemTrait, ItemTy, ItemDefaultImpl};
@@ -5256,7 +5256,7 @@ impl<'a> Parser<'a> {
52565256
Ok(P(ast::ForeignItem {
52575257
ident: ident,
52585258
attrs: attrs,
5259-
node: ForeignItemFn(decl, generics),
5259+
node: ForeignItemKind::Fn(decl, generics),
52605260
id: ast::DUMMY_NODE_ID,
52615261
span: mk_sp(lo, hi),
52625262
vis: vis
@@ -5277,7 +5277,7 @@ impl<'a> Parser<'a> {
52775277
Ok(P(ForeignItem {
52785278
ident: ident,
52795279
attrs: attrs,
5280-
node: ForeignItemStatic(ty, mutbl),
5280+
node: ForeignItemKind::Static(ty, mutbl),
52815281
id: ast::DUMMY_NODE_ID,
52825282
span: mk_sp(lo, hi),
52835283
vis: vis

src/libsyntax/print/pprust.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1046,7 +1046,7 @@ impl<'a> State<'a> {
10461046
try!(self.maybe_print_comment(item.span.lo));
10471047
try!(self.print_outer_attributes(&item.attrs));
10481048
match item.node {
1049-
ast::ForeignItemFn(ref decl, ref generics) => {
1049+
ast::ForeignItemKind::Fn(ref decl, ref generics) => {
10501050
try!(self.head(""));
10511051
try!(self.print_fn(decl, ast::Unsafety::Normal,
10521052
ast::Constness::NotConst,
@@ -1056,7 +1056,7 @@ impl<'a> State<'a> {
10561056
try!(word(&mut self.s, ";"));
10571057
self.end() // end the outer fn box
10581058
}
1059-
ast::ForeignItemStatic(ref t, m) => {
1059+
ast::ForeignItemKind::Static(ref t, m) => {
10601060
try!(self.head(&visibility_qualified(item.vis,
10611061
"static")));
10621062
if m {

src/libsyntax/visit.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -467,11 +467,11 @@ pub fn walk_foreign_item<'v, V: Visitor<'v>>(visitor: &mut V,
467467
visitor.visit_ident(foreign_item.span, foreign_item.ident);
468468

469469
match foreign_item.node {
470-
ForeignItemFn(ref function_declaration, ref generics) => {
470+
ForeignItemKind::Fn(ref function_declaration, ref generics) => {
471471
walk_fn_decl(visitor, function_declaration);
472472
visitor.visit_generics(generics)
473473
}
474-
ForeignItemStatic(ref typ, _) => visitor.visit_ty(typ),
474+
ForeignItemKind::Static(ref typ, _) => visitor.visit_ty(typ),
475475
}
476476

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

0 commit comments

Comments
 (0)