[breaking-change] don't glob export ast::ForeignItem_ variants
This commit is contained in:
parent
8290c950a8
commit
0d6ddd1903
@ -838,10 +838,10 @@ pub fn lower_foreign_item(lctx: &LoweringContext, i: &ForeignItem) -> hir::Forei
|
||||
name: i.ident.name,
|
||||
attrs: lower_attrs(lctx, &i.attrs),
|
||||
node: match i.node {
|
||||
ForeignItemFn(ref fdec, ref generics) => {
|
||||
ForeignItemKind::Fn(ref fdec, ref generics) => {
|
||||
hir::ForeignItemFn(lower_fn_decl(lctx, fdec), lower_generics(lctx, generics))
|
||||
}
|
||||
ForeignItemStatic(ref t, m) => {
|
||||
ForeignItemKind::Static(ref t, m) => {
|
||||
hir::ForeignItemStatic(lower_ty(lctx, t), m)
|
||||
}
|
||||
},
|
||||
|
@ -10,7 +10,6 @@
|
||||
|
||||
// The Rust abstract syntax tree.
|
||||
|
||||
pub use self::ForeignItem_::*;
|
||||
pub use self::Item_::*;
|
||||
pub use self::KleeneOp::*;
|
||||
pub use self::MacStmtStyle::*;
|
||||
@ -2039,7 +2038,7 @@ impl Item_ {
|
||||
pub struct ForeignItem {
|
||||
pub ident: Ident,
|
||||
pub attrs: Vec<Attribute>,
|
||||
pub node: ForeignItem_,
|
||||
pub node: ForeignItemKind,
|
||||
pub id: NodeId,
|
||||
pub span: Span,
|
||||
pub vis: Visibility,
|
||||
@ -2047,19 +2046,19 @@ pub struct ForeignItem {
|
||||
|
||||
/// An item within an `extern` block
|
||||
#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug)]
|
||||
pub enum ForeignItem_ {
|
||||
pub enum ForeignItemKind {
|
||||
/// A foreign function
|
||||
ForeignItemFn(P<FnDecl>, Generics),
|
||||
Fn(P<FnDecl>, 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),
|
||||
}
|
||||
|
||||
impl ForeignItem_ {
|
||||
impl ForeignItemKind {
|
||||
pub fn descriptive_variant(&self) -> &str {
|
||||
match *self {
|
||||
ForeignItemFn(..) => "foreign function",
|
||||
ForeignItemStatic(..) => "foreign static item"
|
||||
ForeignItemKind::Fn(..) => "foreign function",
|
||||
ForeignItemKind::Static(..) => "foreign static item"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1092,11 +1092,11 @@ pub fn noop_fold_foreign_item<T: Folder>(ni: P<ForeignItem>, folder: &mut T) ->
|
||||
ident: folder.fold_ident(ident),
|
||||
attrs: fold_attrs(attrs, folder),
|
||||
node: match node {
|
||||
ForeignItemFn(fdec, generics) => {
|
||||
ForeignItemFn(folder.fold_fn_decl(fdec), folder.fold_generics(generics))
|
||||
ForeignItemKind::Fn(fdec, generics) => {
|
||||
ForeignItemKind::Fn(folder.fold_fn_decl(fdec), folder.fold_generics(generics))
|
||||
}
|
||||
ForeignItemStatic(t, m) => {
|
||||
ForeignItemStatic(folder.fold_ty(t), m)
|
||||
ForeignItemKind::Static(t, m) => {
|
||||
ForeignItemKind::Static(folder.fold_ty(t), m)
|
||||
}
|
||||
},
|
||||
vis: vis,
|
||||
|
@ -22,7 +22,7 @@ use ast::{Decl, DeclKind};
|
||||
use ast::{EMPTY_CTXT, EnumDef, ExplicitSelf};
|
||||
use ast::{Expr, ExprKind};
|
||||
use ast::{Field, FnDecl};
|
||||
use ast::{ForeignItem, ForeignItemStatic, ForeignItemFn, FunctionRetTy};
|
||||
use ast::{ForeignItem, ForeignItemKind, FunctionRetTy};
|
||||
use ast::{Ident, Inherited, ImplItem, Item, Item_, ItemStatic};
|
||||
use ast::{ItemEnum, ItemFn, ItemForeignMod, ItemImpl, ItemConst};
|
||||
use ast::{ItemMac, ItemMod, ItemStruct, ItemTrait, ItemTy, ItemDefaultImpl};
|
||||
@ -5256,7 +5256,7 @@ impl<'a> Parser<'a> {
|
||||
Ok(P(ast::ForeignItem {
|
||||
ident: ident,
|
||||
attrs: attrs,
|
||||
node: ForeignItemFn(decl, generics),
|
||||
node: ForeignItemKind::Fn(decl, generics),
|
||||
id: ast::DUMMY_NODE_ID,
|
||||
span: mk_sp(lo, hi),
|
||||
vis: vis
|
||||
@ -5277,7 +5277,7 @@ impl<'a> Parser<'a> {
|
||||
Ok(P(ForeignItem {
|
||||
ident: ident,
|
||||
attrs: attrs,
|
||||
node: ForeignItemStatic(ty, mutbl),
|
||||
node: ForeignItemKind::Static(ty, mutbl),
|
||||
id: ast::DUMMY_NODE_ID,
|
||||
span: mk_sp(lo, hi),
|
||||
vis: vis
|
||||
|
@ -1046,7 +1046,7 @@ impl<'a> State<'a> {
|
||||
try!(self.maybe_print_comment(item.span.lo));
|
||||
try!(self.print_outer_attributes(&item.attrs));
|
||||
match item.node {
|
||||
ast::ForeignItemFn(ref decl, ref generics) => {
|
||||
ast::ForeignItemKind::Fn(ref decl, ref generics) => {
|
||||
try!(self.head(""));
|
||||
try!(self.print_fn(decl, ast::Unsafety::Normal,
|
||||
ast::Constness::NotConst,
|
||||
@ -1056,7 +1056,7 @@ impl<'a> State<'a> {
|
||||
try!(word(&mut self.s, ";"));
|
||||
self.end() // end the outer fn box
|
||||
}
|
||||
ast::ForeignItemStatic(ref t, m) => {
|
||||
ast::ForeignItemKind::Static(ref t, m) => {
|
||||
try!(self.head(&visibility_qualified(item.vis,
|
||||
"static")));
|
||||
if m {
|
||||
|
@ -467,11 +467,11 @@ pub fn walk_foreign_item<'v, V: Visitor<'v>>(visitor: &mut V,
|
||||
visitor.visit_ident(foreign_item.span, foreign_item.ident);
|
||||
|
||||
match foreign_item.node {
|
||||
ForeignItemFn(ref function_declaration, ref generics) => {
|
||||
ForeignItemKind::Fn(ref function_declaration, ref generics) => {
|
||||
walk_fn_decl(visitor, function_declaration);
|
||||
visitor.visit_generics(generics)
|
||||
}
|
||||
ForeignItemStatic(ref typ, _) => visitor.visit_ty(typ),
|
||||
ForeignItemKind::Static(ref typ, _) => visitor.visit_ty(typ),
|
||||
}
|
||||
|
||||
walk_list!(visitor, visit_attribute, &foreign_item.attrs);
|
||||
|
Loading…
x
Reference in New Issue
Block a user