diff options
| author | Mazdak Farrokhzad <twingoow@gmail.com> | 2019-12-08 00:08:09 +0100 |
|---|---|---|
| committer | Mazdak Farrokhzad <twingoow@gmail.com> | 2019-12-12 18:05:05 +0100 |
| commit | abf2e7aa959a4611bc2f607bc7e9200b8b81c089 (patch) | |
| tree | 74750f2a8b65450bc7b091921681ce63684da9ef /src/libsyntax | |
| parent | 35e9e097e7c7e977f36795c0febceb327e1fa33f (diff) | |
| download | rust-abf2e7aa959a4611bc2f607bc7e9200b8b81c089.tar.gz rust-abf2e7aa959a4611bc2f607bc7e9200b8b81c089.zip | |
Remove `ast::{Impl,Trait}{Item,ItemKind}`.
Diffstat (limited to 'src/libsyntax')
| -rw-r--r-- | src/libsyntax/ast.rs | 14 | ||||
| -rw-r--r-- | src/libsyntax/feature_gate/check.rs | 6 | ||||
| -rw-r--r-- | src/libsyntax/token.rs | 4 |
3 files changed, 9 insertions, 15 deletions
diff --git a/src/libsyntax/ast.rs b/src/libsyntax/ast.rs index d90d74d7a26..1b729ebaf43 100644 --- a/src/libsyntax/ast.rs +++ b/src/libsyntax/ast.rs @@ -1603,16 +1603,10 @@ pub struct FnSig { pub decl: P<FnDecl>, } -// FIXME(Centril): Remove all of these. -pub type TraitItem = AssocItem<AssocItemKind>; -pub type TraitItemKind = AssocItemKind; -pub type ImplItem = AssocItem<AssocItemKind>; -pub type ImplItemKind = AssocItemKind; - /// Represents associated items. /// These include items in `impl` and `trait` definitions. #[derive(Clone, RustcEncodable, RustcDecodable, Debug)] -pub struct AssocItem<K = ImplItemKind> { +pub struct AssocItem { pub attrs: Vec<Attribute>, pub id: NodeId, pub span: Span, @@ -1621,7 +1615,7 @@ pub struct AssocItem<K = ImplItemKind> { pub defaultness: Defaultness, pub generics: Generics, - pub kind: K, + pub kind: AssocItemKind, /// See `Item::tokens` for what this is. pub tokens: Option<TokenStream>, } @@ -2598,7 +2592,7 @@ pub enum ItemKind { /// A trait declaration (`trait`). /// /// E.g., `trait Foo { .. }`, `trait Foo<T> { .. }` or `auto trait Foo {}`. - Trait(IsAuto, Unsafety, Generics, GenericBounds, Vec<TraitItem>), + Trait(IsAuto, Unsafety, Generics, GenericBounds, Vec<AssocItem>), /// Trait alias /// /// E.g., `trait Foo = Bar + Quux;`. @@ -2613,7 +2607,7 @@ pub enum ItemKind { Generics, Option<TraitRef>, // (optional) trait this impl implements P<Ty>, // self - Vec<ImplItem>, + Vec<AssocItem>, ), /// A macro invocation. /// diff --git a/src/libsyntax/feature_gate/check.rs b/src/libsyntax/feature_gate/check.rs index c27fcb6a68e..fcce9d4e95f 100644 --- a/src/libsyntax/feature_gate/check.rs +++ b/src/libsyntax/feature_gate/check.rs @@ -571,9 +571,9 @@ impl<'a> Visitor<'a> for PostExpansionVisitor<'a> { visit::walk_assoc_ty_constraint(self, constraint) } - fn visit_trait_item(&mut self, ti: &'a ast::TraitItem) { + fn visit_trait_item(&mut self, ti: &'a ast::AssocItem) { match ti.kind { - ast::TraitItemKind::Method(ref sig, ref block) => { + ast::AssocItemKind::Method(ref sig, ref block) => { if block.is_none() { self.check_extern(sig.header.ext); } @@ -581,7 +581,7 @@ impl<'a> Visitor<'a> for PostExpansionVisitor<'a> { gate_feature_post!(&self, const_fn, ti.span, "const fn is unstable"); } } - ast::TraitItemKind::TyAlias(_, ref default) => { + ast::AssocItemKind::TyAlias(_, ref default) => { if let Some(_) = default { gate_feature_post!( &self, associated_type_defaults, ti.span, diff --git a/src/libsyntax/token.rs b/src/libsyntax/token.rs index 6f45211ac5f..263f8192241 100644 --- a/src/libsyntax/token.rs +++ b/src/libsyntax/token.rs @@ -685,8 +685,8 @@ pub enum Nonterminal { // Used only for passing items to proc macro attributes (they are not // strictly necessary for that, `Annotatable` can be converted into // tokens directly, but doing that naively regresses pretty-printing). - NtTraitItem(ast::TraitItem), - NtImplItem(ast::ImplItem), + NtTraitItem(ast::AssocItem), + NtImplItem(ast::AssocItem), NtForeignItem(ast::ForeignItem), } |
