diff options
| author | Mazdak Farrokhzad <twingoow@gmail.com> | 2020-02-13 18:05:40 +0100 |
|---|---|---|
| committer | Mazdak Farrokhzad <twingoow@gmail.com> | 2020-02-15 18:00:01 +0100 |
| commit | f06df1629e1144be6a217754303a6585699e0728 (patch) | |
| tree | 20b01eff42ed16cbd78d83e1a262a2ace180d90e | |
| parent | 2fd15442f2f1c798718242eaa9817531a53c2134 (diff) | |
| download | rust-f06df1629e1144be6a217754303a6585699e0728.tar.gz rust-f06df1629e1144be6a217754303a6585699e0728.zip | |
ast: colocate AssocItem with ForeignItem
| -rw-r--r-- | src/libsyntax/ast.rs | 78 |
1 files changed, 39 insertions, 39 deletions
diff --git a/src/libsyntax/ast.rs b/src/libsyntax/ast.rs index 7f6e405fec6..2eab688fd9d 100644 --- a/src/libsyntax/ast.rs +++ b/src/libsyntax/ast.rs @@ -1605,45 +1605,6 @@ pub struct FnSig { pub decl: P<FnDecl>, } -/// Represents associated items. -/// These include items in `impl` and `trait` definitions. -#[derive(Clone, RustcEncodable, RustcDecodable, Debug)] -pub struct AssocItem { - pub attrs: Vec<Attribute>, - pub id: NodeId, - pub span: Span, - pub vis: Visibility, - pub ident: Ident, - - pub defaultness: Defaultness, - pub kind: AssocItemKind, - /// See `Item::tokens` for what this is. - pub tokens: Option<TokenStream>, -} - -/// Represents various kinds of content within an `impl`. -/// -/// The term "provided" in the variants below refers to the item having a default -/// definition / body. Meanwhile, a "required" item lacks a definition / body. -/// In an implementation, all items must be provided. -/// The `Option`s below denote the bodies, where `Some(_)` -/// means "provided" and conversely `None` means "required". -#[derive(Clone, RustcEncodable, RustcDecodable, Debug)] -pub enum AssocItemKind { - /// An associated constant, `const $ident: $ty $def?;` where `def ::= "=" $expr? ;`. - /// If `def` is parsed, then the associated constant is provided, and otherwise required. - Const(P<Ty>, Option<P<Expr>>), - - /// An associated function. - Fn(FnSig, Generics, Option<P<Block>>), - - /// An associated type. - TyAlias(Generics, GenericBounds, Option<P<Ty>>), - - /// A macro expanding to an associated item. - Macro(Mac), -} - #[derive( Clone, Copy, @@ -2664,3 +2625,42 @@ impl ForeignItemKind { } } } + +/// Represents associated items. +/// These include items in `impl` and `trait` definitions. +#[derive(Clone, RustcEncodable, RustcDecodable, Debug)] +pub struct AssocItem { + pub attrs: Vec<Attribute>, + pub id: NodeId, + pub span: Span, + pub vis: Visibility, + pub ident: Ident, + + pub defaultness: Defaultness, + pub kind: AssocItemKind, + /// See `Item::tokens` for what this is. + pub tokens: Option<TokenStream>, +} + +/// Represents various kinds of content within an `impl`. +/// +/// The term "provided" in the variants below refers to the item having a default +/// definition / body. Meanwhile, a "required" item lacks a definition / body. +/// In an implementation, all items must be provided. +/// The `Option`s below denote the bodies, where `Some(_)` +/// means "provided" and conversely `None` means "required". +#[derive(Clone, RustcEncodable, RustcDecodable, Debug)] +pub enum AssocItemKind { + /// An associated constant, `const $ident: $ty $def?;` where `def ::= "=" $expr? ;`. + /// If `def` is parsed, then the associated constant is provided, and otherwise required. + Const(P<Ty>, Option<P<Expr>>), + + /// An associated function. + Fn(FnSig, Generics, Option<P<Block>>), + + /// An associated type. + TyAlias(Generics, GenericBounds, Option<P<Ty>>), + + /// A macro expanding to an associated item. + Macro(Mac), +} |
