Skip to content

Commit 91110fd

Browse files
committed
ast: make ForeignItemKind an alias of AssocItemKind
1 parent 35884fe commit 91110fd

File tree

1 file changed

+3
-30
lines changed

1 file changed

+3
-30
lines changed

src/libsyntax/ast.rs

Lines changed: 3 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -2600,35 +2600,8 @@ impl ItemKind {
26002600
}
26012601
}
26022602

2603-
pub type ForeignItem = Item<ForeignItemKind>;
2604-
2605-
/// An item within an `extern` block.
2606-
#[derive(Clone, RustcEncodable, RustcDecodable, Debug)]
2607-
pub enum ForeignItemKind {
2608-
/// A constant, `const $ident: $ty $def?;` where `def ::= "=" $expr? ;`.
2609-
/// If `def` is parsed, then the constant is provided, and otherwise required.
2610-
Const(P<Ty>, Option<P<Expr>>),
2611-
/// A static item (`static FOO: u8`).
2612-
Static(P<Ty>, Mutability, Option<P<Expr>>),
2613-
/// A function.
2614-
Fn(FnSig, Generics, Option<P<Block>>),
2615-
/// A type.
2616-
TyAlias(Generics, GenericBounds, Option<P<Ty>>),
2617-
/// A macro expanding to an item.
2618-
Macro(Mac),
2619-
}
2620-
2621-
impl ForeignItemKind {
2622-
pub fn descriptive_variant(&self) -> &str {
2623-
match *self {
2624-
ForeignItemKind::Fn(..) => "foreign function",
2625-
ForeignItemKind::Const(..) => "foreign const item",
2626-
ForeignItemKind::Static(..) => "foreign static item",
2627-
ForeignItemKind::TyAlias(..) => "foreign type",
2628-
ForeignItemKind::Macro(..) => "macro in foreign module",
2629-
}
2630-
}
2631-
}
2603+
pub type ForeignItem = Item<AssocItemKind>;
2604+
pub type ForeignItemKind = AssocItemKind;
26322605

26332606
/// Represents associated items.
26342607
/// These include items in `impl` and `trait` definitions.
@@ -2646,7 +2619,7 @@ pub struct AssocItem {
26462619
pub tokens: Option<TokenStream>,
26472620
}
26482621

2649-
/// Represents various kinds of content within an `impl`.
2622+
/// Represents non-free item kinds.
26502623
///
26512624
/// The term "provided" in the variants below refers to the item having a default
26522625
/// definition / body. Meanwhile, a "required" item lacks a definition / body.

0 commit comments

Comments
 (0)