@@ -789,14 +789,14 @@ pub struct PatField {
789789#[ derive( Clone , Copy , Debug , Eq , PartialEq ) ]
790790#[ derive( Encodable , Decodable , HashStable_Generic , Walkable ) ]
791791pub enum ByRef {
792- Yes ( Mutability ) ,
792+ Yes ( Pinnedness , Mutability ) ,
793793 No ,
794794}
795795
796796impl ByRef {
797797 #[ must_use]
798798 pub fn cap_ref_mutability ( mut self , mutbl : Mutability ) -> Self {
799- if let ByRef :: Yes ( old_mutbl) = & mut self {
799+ if let ByRef :: Yes ( _ , old_mutbl) = & mut self {
800800 * old_mutbl = cmp:: min ( * old_mutbl, mutbl) ;
801801 }
802802 self
@@ -814,20 +814,33 @@ pub struct BindingMode(pub ByRef, pub Mutability);
814814
815815impl BindingMode {
816816 pub const NONE : Self = Self ( ByRef :: No , Mutability :: Not ) ;
817- pub const REF : Self = Self ( ByRef :: Yes ( Mutability :: Not ) , Mutability :: Not ) ;
817+ pub const REF : Self = Self ( ByRef :: Yes ( Pinnedness :: Not , Mutability :: Not ) , Mutability :: Not ) ;
818+ pub const REF_PIN : Self =
819+ Self ( ByRef :: Yes ( Pinnedness :: Pinned , Mutability :: Not ) , Mutability :: Not ) ;
818820 pub const MUT : Self = Self ( ByRef :: No , Mutability :: Mut ) ;
819- pub const REF_MUT : Self = Self ( ByRef :: Yes ( Mutability :: Mut ) , Mutability :: Not ) ;
820- pub const MUT_REF : Self = Self ( ByRef :: Yes ( Mutability :: Not ) , Mutability :: Mut ) ;
821- pub const MUT_REF_MUT : Self = Self ( ByRef :: Yes ( Mutability :: Mut ) , Mutability :: Mut ) ;
821+ pub const REF_MUT : Self = Self ( ByRef :: Yes ( Pinnedness :: Not , Mutability :: Mut ) , Mutability :: Not ) ;
822+ pub const REF_PIN_MUT : Self =
823+ Self ( ByRef :: Yes ( Pinnedness :: Pinned , Mutability :: Mut ) , Mutability :: Not ) ;
824+ pub const MUT_REF : Self = Self ( ByRef :: Yes ( Pinnedness :: Not , Mutability :: Not ) , Mutability :: Mut ) ;
825+ pub const MUT_REF_PIN : Self =
826+ Self ( ByRef :: Yes ( Pinnedness :: Pinned , Mutability :: Not ) , Mutability :: Mut ) ;
827+ pub const MUT_REF_MUT : Self =
828+ Self ( ByRef :: Yes ( Pinnedness :: Not , Mutability :: Mut ) , Mutability :: Mut ) ;
829+ pub const MUT_REF_PIN_MUT : Self =
830+ Self ( ByRef :: Yes ( Pinnedness :: Pinned , Mutability :: Mut ) , Mutability :: Mut ) ;
822831
823832 pub fn prefix_str ( self ) -> & ' static str {
824833 match self {
825834 Self :: NONE => "" ,
826835 Self :: REF => "ref " ,
836+ Self :: REF_PIN => "ref pin const " ,
827837 Self :: MUT => "mut " ,
828838 Self :: REF_MUT => "ref mut " ,
839+ Self :: REF_PIN_MUT => "ref pin mut " ,
829840 Self :: MUT_REF => "mut ref " ,
841+ Self :: MUT_REF_PIN => "mut ref pin " ,
830842 Self :: MUT_REF_MUT => "mut ref mut " ,
843+ Self :: MUT_REF_PIN_MUT => "mut ref pin mut " ,
831844 }
832845 }
833846}
@@ -3540,8 +3553,9 @@ impl Item {
35403553 ItemKind :: Const ( i) => Some ( & i. generics ) ,
35413554 ItemKind :: Fn ( i) => Some ( & i. generics ) ,
35423555 ItemKind :: TyAlias ( i) => Some ( & i. generics ) ,
3543- ItemKind :: TraitAlias ( _, generics, _)
3544- | ItemKind :: Enum ( _, generics, _)
3556+ ItemKind :: TraitAlias ( i) => Some ( & i. generics ) ,
3557+
3558+ ItemKind :: Enum ( _, generics, _)
35453559 | ItemKind :: Struct ( _, generics, _)
35463560 | ItemKind :: Union ( _, generics, _) => Some ( & generics) ,
35473561 ItemKind :: Trait ( i) => Some ( & i. generics ) ,
@@ -3623,6 +3637,15 @@ impl Default for FnHeader {
36233637 }
36243638}
36253639
3640+ #[ derive( Clone , Encodable , Decodable , Debug , Walkable ) ]
3641+ pub struct TraitAlias {
3642+ pub constness : Const ,
3643+ pub ident : Ident ,
3644+ pub generics : Generics ,
3645+ #[ visitable( extra = BoundKind :: Bound ) ]
3646+ pub bounds : GenericBounds ,
3647+ }
3648+
36263649#[ derive( Clone , Encodable , Decodable , Debug , Walkable ) ]
36273650pub struct Trait {
36283651 pub constness : Const ,
@@ -3798,7 +3821,7 @@ pub enum ItemKind {
37983821 /// Trait alias.
37993822 ///
38003823 /// E.g., `trait Foo = Bar + Quux;`.
3801- TraitAlias ( Ident , Generics , GenericBounds ) ,
3824+ TraitAlias ( Box < TraitAlias > ) ,
38023825 /// An implementation.
38033826 ///
38043827 /// E.g., `impl<A> Foo<A> { .. }` or `impl<A> Trait for Foo<A> { .. }`.
@@ -3831,7 +3854,7 @@ impl ItemKind {
38313854 | ItemKind :: Struct ( ident, ..)
38323855 | ItemKind :: Union ( ident, ..)
38333856 | ItemKind :: Trait ( box Trait { ident, .. } )
3834- | ItemKind :: TraitAlias ( ident, ..)
3857+ | ItemKind :: TraitAlias ( box TraitAlias { ident, .. } )
38353858 | ItemKind :: MacroDef ( ident, _)
38363859 | ItemKind :: Delegation ( box Delegation { ident, .. } ) => Some ( ident) ,
38373860
@@ -3888,7 +3911,7 @@ impl ItemKind {
38883911 | Self :: Struct ( _, generics, _)
38893912 | Self :: Union ( _, generics, _)
38903913 | Self :: Trait ( box Trait { generics, .. } )
3891- | Self :: TraitAlias ( _ , generics, _ )
3914+ | Self :: TraitAlias ( box TraitAlias { generics, .. } )
38923915 | Self :: Impl ( Impl { generics, .. } ) => Some ( generics) ,
38933916 _ => None ,
38943917 }
@@ -4050,8 +4073,8 @@ mod size_asserts {
40504073 static_assert_size ! ( GenericBound , 88 ) ;
40514074 static_assert_size ! ( Generics , 40 ) ;
40524075 static_assert_size ! ( Impl , 64 ) ;
4053- static_assert_size ! ( Item , 144 ) ;
4054- static_assert_size ! ( ItemKind , 80 ) ;
4076+ static_assert_size ! ( Item , 136 ) ;
4077+ static_assert_size ! ( ItemKind , 72 ) ;
40554078 static_assert_size ! ( LitKind , 24 ) ;
40564079 static_assert_size ! ( Local , 96 ) ;
40574080 static_assert_size ! ( MetaItemLit , 40 ) ;
0 commit comments