Skip to content

Commit f06df16

Browse files
committed
ast: colocate AssocItem with ForeignItem
1 parent 2fd1544 commit f06df16

File tree

1 file changed

+39
-39
lines changed

1 file changed

+39
-39
lines changed

src/libsyntax/ast.rs

Lines changed: 39 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1605,45 +1605,6 @@ pub struct FnSig {
16051605
pub decl: P<FnDecl>,
16061606
}
16071607

1608-
/// Represents associated items.
1609-
/// These include items in `impl` and `trait` definitions.
1610-
#[derive(Clone, RustcEncodable, RustcDecodable, Debug)]
1611-
pub struct AssocItem {
1612-
pub attrs: Vec<Attribute>,
1613-
pub id: NodeId,
1614-
pub span: Span,
1615-
pub vis: Visibility,
1616-
pub ident: Ident,
1617-
1618-
pub defaultness: Defaultness,
1619-
pub kind: AssocItemKind,
1620-
/// See `Item::tokens` for what this is.
1621-
pub tokens: Option<TokenStream>,
1622-
}
1623-
1624-
/// Represents various kinds of content within an `impl`.
1625-
///
1626-
/// The term "provided" in the variants below refers to the item having a default
1627-
/// definition / body. Meanwhile, a "required" item lacks a definition / body.
1628-
/// In an implementation, all items must be provided.
1629-
/// The `Option`s below denote the bodies, where `Some(_)`
1630-
/// means "provided" and conversely `None` means "required".
1631-
#[derive(Clone, RustcEncodable, RustcDecodable, Debug)]
1632-
pub enum AssocItemKind {
1633-
/// An associated constant, `const $ident: $ty $def?;` where `def ::= "=" $expr? ;`.
1634-
/// If `def` is parsed, then the associated constant is provided, and otherwise required.
1635-
Const(P<Ty>, Option<P<Expr>>),
1636-
1637-
/// An associated function.
1638-
Fn(FnSig, Generics, Option<P<Block>>),
1639-
1640-
/// An associated type.
1641-
TyAlias(Generics, GenericBounds, Option<P<Ty>>),
1642-
1643-
/// A macro expanding to an associated item.
1644-
Macro(Mac),
1645-
}
1646-
16471608
#[derive(
16481609
Clone,
16491610
Copy,
@@ -2664,3 +2625,42 @@ impl ForeignItemKind {
26642625
}
26652626
}
26662627
}
2628+
2629+
/// Represents associated items.
2630+
/// These include items in `impl` and `trait` definitions.
2631+
#[derive(Clone, RustcEncodable, RustcDecodable, Debug)]
2632+
pub struct AssocItem {
2633+
pub attrs: Vec<Attribute>,
2634+
pub id: NodeId,
2635+
pub span: Span,
2636+
pub vis: Visibility,
2637+
pub ident: Ident,
2638+
2639+
pub defaultness: Defaultness,
2640+
pub kind: AssocItemKind,
2641+
/// See `Item::tokens` for what this is.
2642+
pub tokens: Option<TokenStream>,
2643+
}
2644+
2645+
/// Represents various kinds of content within an `impl`.
2646+
///
2647+
/// The term "provided" in the variants below refers to the item having a default
2648+
/// definition / body. Meanwhile, a "required" item lacks a definition / body.
2649+
/// In an implementation, all items must be provided.
2650+
/// The `Option`s below denote the bodies, where `Some(_)`
2651+
/// means "provided" and conversely `None` means "required".
2652+
#[derive(Clone, RustcEncodable, RustcDecodable, Debug)]
2653+
pub enum AssocItemKind {
2654+
/// An associated constant, `const $ident: $ty $def?;` where `def ::= "=" $expr? ;`.
2655+
/// If `def` is parsed, then the associated constant is provided, and otherwise required.
2656+
Const(P<Ty>, Option<P<Expr>>),
2657+
2658+
/// An associated function.
2659+
Fn(FnSig, Generics, Option<P<Block>>),
2660+
2661+
/// An associated type.
2662+
TyAlias(Generics, GenericBounds, Option<P<Ty>>),
2663+
2664+
/// A macro expanding to an associated item.
2665+
Macro(Mac),
2666+
}

0 commit comments

Comments
 (0)