@@ -2897,6 +2897,13 @@ pub struct Static {
28972897 pub expr : Option < P < Expr > > ,
28982898}
28992899
2900+ #[ derive( Clone , Encodable , Decodable , Debug ) ]
2901+ pub struct ConstItem {
2902+ pub defaultness : Defaultness ,
2903+ pub ty : P < Ty > ,
2904+ pub expr : Option < P < Expr > > ,
2905+ }
2906+
29002907#[ derive( Clone , Encodable , Decodable , Debug ) ]
29012908pub enum ItemKind {
29022909 /// An `extern crate` item, with the optional *original* crate name if the crate was renamed.
@@ -2914,7 +2921,7 @@ pub enum ItemKind {
29142921 /// A constant item (`const`).
29152922 ///
29162923 /// E.g., `const FOO: i32 = 42;`.
2917- Const ( Defaultness , P < Ty > , Option < P < Expr > > ) ,
2924+ Const ( ConstItem ) ,
29182925 /// A function declaration (`fn`).
29192926 ///
29202927 /// E.g., `fn foo(bar: usize) -> usize { .. }`.
@@ -3030,7 +3037,7 @@ pub type AssocItem = Item<AssocItemKind>;
30303037pub enum AssocItemKind {
30313038 /// An associated constant, `const $ident: $ty $def?;` where `def ::= "=" $expr? ;`.
30323039 /// If `def` is parsed, then the constant is provided, and otherwise required.
3033- Const ( Defaultness , P < Ty > , Option < P < Expr > > ) ,
3040+ Const ( ConstItem ) ,
30343041 /// An associated function.
30353042 Fn ( Box < Fn > ) ,
30363043 /// An associated type.
@@ -3042,7 +3049,7 @@ pub enum AssocItemKind {
30423049impl AssocItemKind {
30433050 pub fn defaultness ( & self ) -> Defaultness {
30443051 match * self {
3045- Self :: Const ( defaultness, ..)
3052+ Self :: Const ( ConstItem { defaultness, .. } )
30463053 | Self :: Fn ( box Fn { defaultness, .. } )
30473054 | Self :: Type ( box TyAlias { defaultness, .. } ) => defaultness,
30483055 Self :: MacCall ( ..) => Defaultness :: Final ,
@@ -3053,7 +3060,7 @@ impl AssocItemKind {
30533060impl From < AssocItemKind > for ItemKind {
30543061 fn from ( assoc_item_kind : AssocItemKind ) -> ItemKind {
30553062 match assoc_item_kind {
3056- AssocItemKind :: Const ( a , b , c ) => ItemKind :: Const ( a , b , c ) ,
3063+ AssocItemKind :: Const ( item ) => ItemKind :: Const ( item ) ,
30573064 AssocItemKind :: Fn ( fn_kind) => ItemKind :: Fn ( fn_kind) ,
30583065 AssocItemKind :: Type ( ty_alias_kind) => ItemKind :: TyAlias ( ty_alias_kind) ,
30593066 AssocItemKind :: MacCall ( a) => ItemKind :: MacCall ( a) ,
@@ -3066,7 +3073,7 @@ impl TryFrom<ItemKind> for AssocItemKind {
30663073
30673074 fn try_from ( item_kind : ItemKind ) -> Result < AssocItemKind , ItemKind > {
30683075 Ok ( match item_kind {
3069- ItemKind :: Const ( a , b , c ) => AssocItemKind :: Const ( a , b , c ) ,
3076+ ItemKind :: Const ( item ) => AssocItemKind :: Const ( item ) ,
30703077 ItemKind :: Fn ( fn_kind) => AssocItemKind :: Fn ( fn_kind) ,
30713078 ItemKind :: TyAlias ( ty_kind) => AssocItemKind :: Type ( ty_kind) ,
30723079 ItemKind :: MacCall ( a) => AssocItemKind :: MacCall ( a) ,
0 commit comments