@@ -3538,8 +3538,9 @@ impl Item {
35383538 ItemKind :: Const ( i) => Some ( & i. generics ) ,
35393539 ItemKind :: Fn ( i) => Some ( & i. generics ) ,
35403540 ItemKind :: TyAlias ( i) => Some ( & i. generics ) ,
3541- ItemKind :: TraitAlias ( _, generics, _)
3542- | ItemKind :: Enum ( _, generics, _)
3541+ ItemKind :: TraitAlias ( i) => Some ( & i. generics ) ,
3542+
3543+ ItemKind :: Enum ( _, generics, _)
35433544 | ItemKind :: Struct ( _, generics, _)
35443545 | ItemKind :: Union ( _, generics, _) => Some ( & generics) ,
35453546 ItemKind :: Trait ( i) => Some ( & i. generics ) ,
@@ -3621,6 +3622,14 @@ impl Default for FnHeader {
36213622 }
36223623}
36233624
3625+ #[ derive( Clone , Encodable , Decodable , Debug , Walkable ) ]
3626+ pub struct TraitAlias {
3627+ pub ident : Ident ,
3628+ pub generics : Generics ,
3629+ #[ visitable( extra = BoundKind :: Bound ) ]
3630+ pub bounds : GenericBounds ,
3631+ }
3632+
36243633#[ derive( Clone , Encodable , Decodable , Debug , Walkable ) ]
36253634pub struct Trait {
36263635 pub constness : Const ,
@@ -3816,7 +3825,7 @@ pub enum ItemKind {
38163825 /// Trait alias.
38173826 ///
38183827 /// E.g., `trait Foo = Bar + Quux;`.
3819- TraitAlias ( Ident , Generics , GenericBounds ) ,
3828+ TraitAlias ( Box < TraitAlias > ) ,
38203829 /// An implementation.
38213830 ///
38223831 /// E.g., `impl<A> Foo<A> { .. }` or `impl<A> Trait for Foo<A> { .. }`.
@@ -3849,7 +3858,7 @@ impl ItemKind {
38493858 | ItemKind :: Struct ( ident, ..)
38503859 | ItemKind :: Union ( ident, ..)
38513860 | ItemKind :: Trait ( box Trait { ident, .. } )
3852- | ItemKind :: TraitAlias ( ident, ..)
3861+ | ItemKind :: TraitAlias ( box TraitAlias { ident, .. } )
38533862 | ItemKind :: MacroDef ( ident, _)
38543863 | ItemKind :: Delegation ( box Delegation { ident, .. } ) => Some ( ident) ,
38553864
@@ -3906,7 +3915,7 @@ impl ItemKind {
39063915 | Self :: Struct ( _, generics, _)
39073916 | Self :: Union ( _, generics, _)
39083917 | Self :: Trait ( box Trait { generics, .. } )
3909- | Self :: TraitAlias ( _ , generics, _ )
3918+ | Self :: TraitAlias ( box TraitAlias { generics, .. } )
39103919 | Self :: Impl ( Impl { generics, .. } ) => Some ( generics) ,
39113920 _ => None ,
39123921 }
@@ -4068,8 +4077,8 @@ mod size_asserts {
40684077 static_assert_size ! ( GenericBound , 88 ) ;
40694078 static_assert_size ! ( Generics , 40 ) ;
40704079 static_assert_size ! ( Impl , 64 ) ;
4071- static_assert_size ! ( Item , 144 ) ;
4072- static_assert_size ! ( ItemKind , 80 ) ;
4080+ static_assert_size ! ( Item , 136 ) ;
4081+ static_assert_size ! ( ItemKind , 72 ) ;
40734082 static_assert_size ! ( LitKind , 24 ) ;
40744083 static_assert_size ! ( Local , 96 ) ;
40754084 static_assert_size ! ( MetaItemLit , 40 ) ;
0 commit comments