@@ -2685,6 +2685,12 @@ pub struct ImplKind {
2685
2685
#[ derive( Clone , Encodable , Decodable , Debug ) ]
2686
2686
pub struct FnKind ( pub Defaultness , pub FnSig , pub Generics , pub Option < P < Block > > ) ;
2687
2687
2688
+ #[ derive( Clone , Encodable , Decodable , Debug ) ]
2689
+ pub struct StaticKind ( pub P < Ty > , pub Mutability , pub Option < P < Expr > > ) ;
2690
+
2691
+ #[ derive( Clone , Encodable , Decodable , Debug ) ]
2692
+ pub struct ConstKind ( pub Defaultness , pub P < Ty > , pub Option < P < Expr > > ) ;
2693
+
2688
2694
#[ derive( Clone , Encodable , Decodable , Debug ) ]
2689
2695
pub enum ItemKind {
2690
2696
/// An `extern crate` item, with the optional *original* crate name if the crate was renamed.
@@ -2698,11 +2704,11 @@ pub enum ItemKind {
2698
2704
/// A static item (`static`).
2699
2705
///
2700
2706
/// E.g., `static FOO: i32 = 42;` or `static FOO: &'static str = "bar";`.
2701
- Static ( P < Ty > , Mutability , Option < P < Expr > > ) ,
2707
+ Static ( Box < StaticKind > ) ,
2702
2708
/// A constant item (`const`).
2703
2709
///
2704
2710
/// E.g., `const FOO: i32 = 42;`.
2705
- Const ( Defaultness , P < Ty > , Option < P < Expr > > ) ,
2711
+ Const ( Box < ConstKind > ) ,
2706
2712
/// A function declaration (`fn`).
2707
2713
///
2708
2714
/// E.g., `fn foo(bar: usize) -> usize { .. }`.
@@ -2748,7 +2754,7 @@ pub enum ItemKind {
2748
2754
/// A macro invocation.
2749
2755
///
2750
2756
/// E.g., `foo!(..)`.
2751
- MacCall ( MacCall ) ,
2757
+ MacCall ( Box < MacCall > ) ,
2752
2758
2753
2759
/// A macro definition.
2754
2760
MacroDef ( MacroDef ) ,
@@ -2819,22 +2825,22 @@ pub type AssocItem = Item<AssocItemKind>;
2819
2825
pub enum AssocItemKind {
2820
2826
/// An associated constant, `const $ident: $ty $def?;` where `def ::= "=" $expr? ;`.
2821
2827
/// If `def` is parsed, then the constant is provided, and otherwise required.
2822
- Const ( Defaultness , P < Ty > , Option < P < Expr > > ) ,
2828
+ Const ( Box < ConstKind > ) ,
2823
2829
/// An associated function.
2824
2830
Fn ( Box < FnKind > ) ,
2825
2831
/// An associated type.
2826
2832
TyAlias ( Box < TyAliasKind > ) ,
2827
2833
/// A macro expanding to associated items.
2828
- MacCall ( MacCall ) ,
2834
+ MacCall ( Box < MacCall > ) ,
2829
2835
}
2830
2836
2831
2837
#[ cfg( target_arch = "x86_64" ) ]
2832
- rustc_data_structures:: static_assert_size!( AssocItemKind , 72 ) ;
2838
+ rustc_data_structures:: static_assert_size!( AssocItemKind , 16 ) ;
2833
2839
2834
2840
impl AssocItemKind {
2835
2841
pub fn defaultness ( & self ) -> Defaultness {
2836
2842
match * self {
2837
- Self :: Const ( def, ..)
2843
+ Self :: Const ( box ConstKind ( def, ..) )
2838
2844
| Self :: Fn ( box FnKind ( def, ..) )
2839
2845
| Self :: TyAlias ( box TyAliasKind ( def, ..) ) => def,
2840
2846
Self :: MacCall ( ..) => Defaultness :: Final ,
@@ -2845,7 +2851,7 @@ impl AssocItemKind {
2845
2851
impl From < AssocItemKind > for ItemKind {
2846
2852
fn from ( assoc_item_kind : AssocItemKind ) -> ItemKind {
2847
2853
match assoc_item_kind {
2848
- AssocItemKind :: Const ( a , b , c ) => ItemKind :: Const ( a , b , c ) ,
2854
+ AssocItemKind :: Const ( const_kind ) => ItemKind :: Const ( const_kind ) ,
2849
2855
AssocItemKind :: Fn ( fn_kind) => ItemKind :: Fn ( fn_kind) ,
2850
2856
AssocItemKind :: TyAlias ( ty_alias_kind) => ItemKind :: TyAlias ( ty_alias_kind) ,
2851
2857
AssocItemKind :: MacCall ( a) => ItemKind :: MacCall ( a) ,
@@ -2858,7 +2864,7 @@ impl TryFrom<ItemKind> for AssocItemKind {
2858
2864
2859
2865
fn try_from ( item_kind : ItemKind ) -> Result < AssocItemKind , ItemKind > {
2860
2866
Ok ( match item_kind {
2861
- ItemKind :: Const ( a , b , c ) => AssocItemKind :: Const ( a , b , c ) ,
2867
+ ItemKind :: Const ( const_kind ) => AssocItemKind :: Const ( const_kind ) ,
2862
2868
ItemKind :: Fn ( fn_kind) => AssocItemKind :: Fn ( fn_kind) ,
2863
2869
ItemKind :: TyAlias ( ty_alias_kind) => AssocItemKind :: TyAlias ( ty_alias_kind) ,
2864
2870
ItemKind :: MacCall ( a) => AssocItemKind :: MacCall ( a) ,
@@ -2871,22 +2877,22 @@ impl TryFrom<ItemKind> for AssocItemKind {
2871
2877
#[ derive( Clone , Encodable , Decodable , Debug ) ]
2872
2878
pub enum ForeignItemKind {
2873
2879
/// A foreign static item (`static FOO: u8`).
2874
- Static ( P < Ty > , Mutability , Option < P < Expr > > ) ,
2880
+ Static ( Box < StaticKind > ) ,
2875
2881
/// An foreign function.
2876
2882
Fn ( Box < FnKind > ) ,
2877
2883
/// An foreign type.
2878
2884
TyAlias ( Box < TyAliasKind > ) ,
2879
2885
/// A macro expanding to foreign items.
2880
- MacCall ( MacCall ) ,
2886
+ MacCall ( Box < MacCall > ) ,
2881
2887
}
2882
2888
2883
2889
#[ cfg( target_arch = "x86_64" ) ]
2884
- rustc_data_structures:: static_assert_size!( ForeignItemKind , 72 ) ;
2890
+ rustc_data_structures:: static_assert_size!( ForeignItemKind , 16 ) ;
2885
2891
2886
2892
impl From < ForeignItemKind > for ItemKind {
2887
2893
fn from ( foreign_item_kind : ForeignItemKind ) -> ItemKind {
2888
2894
match foreign_item_kind {
2889
- ForeignItemKind :: Static ( a , b , c ) => ItemKind :: Static ( a , b , c ) ,
2895
+ ForeignItemKind :: Static ( static_kind ) => ItemKind :: Static ( static_kind ) ,
2890
2896
ForeignItemKind :: Fn ( fn_kind) => ItemKind :: Fn ( fn_kind) ,
2891
2897
ForeignItemKind :: TyAlias ( ty_alias_kind) => ItemKind :: TyAlias ( ty_alias_kind) ,
2892
2898
ForeignItemKind :: MacCall ( a) => ItemKind :: MacCall ( a) ,
@@ -2899,7 +2905,7 @@ impl TryFrom<ItemKind> for ForeignItemKind {
2899
2905
2900
2906
fn try_from ( item_kind : ItemKind ) -> Result < ForeignItemKind , ItemKind > {
2901
2907
Ok ( match item_kind {
2902
- ItemKind :: Static ( a , b , c ) => ForeignItemKind :: Static ( a , b , c ) ,
2908
+ ItemKind :: Static ( static_kind ) => ForeignItemKind :: Static ( static_kind ) ,
2903
2909
ItemKind :: Fn ( fn_kind) => ForeignItemKind :: Fn ( fn_kind) ,
2904
2910
ItemKind :: TyAlias ( ty_alias_kind) => ForeignItemKind :: TyAlias ( ty_alias_kind) ,
2905
2911
ItemKind :: MacCall ( a) => ForeignItemKind :: MacCall ( a) ,
0 commit comments