@@ -720,18 +720,22 @@ impl ByRef {
720720/// Used for both the explicit binding annotations given in the HIR for a binding
721721/// and the final binding mode that we infer after type inference/match ergonomics.
722722/// `.0` is the by-reference mode (`ref`, `ref mut`, or by value),
723- /// `.1` is the mutability of the binding.
723+ /// `.1` is the pinnedness of the binding,
724+ /// `.2` is the mutability of the binding.
724725#[ derive( Clone , Copy , Debug , Eq , PartialEq ) ]
725726#[ derive( Encodable , Decodable , HashStable_Generic ) ]
726- pub struct BindingMode ( pub ByRef , pub Mutability ) ;
727+ pub struct BindingMode ( pub ByRef , pub Pinnedness , pub Mutability ) ;
727728
728729impl BindingMode {
729- pub const NONE : Self = Self ( ByRef :: No , Mutability :: Not ) ;
730- pub const REF : Self = Self ( ByRef :: Yes ( Mutability :: Not ) , Mutability :: Not ) ;
731- pub const MUT : Self = Self ( ByRef :: No , Mutability :: Mut ) ;
732- pub const REF_MUT : Self = Self ( ByRef :: Yes ( Mutability :: Mut ) , Mutability :: Not ) ;
733- pub const MUT_REF : Self = Self ( ByRef :: Yes ( Mutability :: Not ) , Mutability :: Mut ) ;
734- pub const MUT_REF_MUT : Self = Self ( ByRef :: Yes ( Mutability :: Mut ) , Mutability :: Mut ) ;
730+ pub const NONE : Self = Self ( ByRef :: No , Pinnedness :: Not , Mutability :: Not ) ;
731+ pub const REF : Self = Self ( ByRef :: Yes ( Mutability :: Not ) , Pinnedness :: Not , Mutability :: Not ) ;
732+ pub const MUT : Self = Self ( ByRef :: No , Pinnedness :: Not , Mutability :: Mut ) ;
733+ pub const REF_MUT : Self = Self ( ByRef :: Yes ( Mutability :: Mut ) , Pinnedness :: Not , Mutability :: Not ) ;
734+ pub const MUT_REF : Self = Self ( ByRef :: Yes ( Mutability :: Not ) , Pinnedness :: Not , Mutability :: Mut ) ;
735+ pub const MUT_REF_MUT : Self =
736+ Self ( ByRef :: Yes ( Mutability :: Mut ) , Pinnedness :: Not , Mutability :: Mut ) ;
737+ pub const PIN_CONST : Self = Self ( ByRef :: No , Pinnedness :: Pinned , Mutability :: Not ) ;
738+ pub const PIN_MUT : Self = Self ( ByRef :: No , Pinnedness :: Pinned , Mutability :: Mut ) ;
735739
736740 pub fn prefix_str ( self ) -> & ' static str {
737741 match self {
@@ -741,6 +745,9 @@ impl BindingMode {
741745 Self :: REF_MUT => "ref mut " ,
742746 Self :: MUT_REF => "mut ref " ,
743747 Self :: MUT_REF_MUT => "mut ref mut " ,
748+ Self :: PIN_CONST => "pin const " ,
749+ Self :: PIN_MUT => "pin mut " ,
750+ Self ( _, Pinnedness :: Pinned , _) => panic ! ( "unsupported pinned binding mode" ) ,
744751 }
745752 }
746753}
@@ -2583,7 +2590,9 @@ pub type ExplicitSelf = Spanned<SelfKind>;
25832590impl Param {
25842591 /// Attempts to cast parameter to `ExplicitSelf`.
25852592 pub fn to_self ( & self ) -> Option < ExplicitSelf > {
2586- if let PatKind :: Ident ( BindingMode ( ByRef :: No , mutbl) , ident, _) = self . pat . kind {
2593+ if let PatKind :: Ident ( BindingMode ( ByRef :: No , Pinnedness :: Not , mutbl) , ident, _) =
2594+ self . pat . kind
2595+ {
25872596 if ident. name == kw:: SelfLower {
25882597 return match self . ty . kind {
25892598 TyKind :: ImplicitSelf => Some ( respan ( self . pat . span , SelfKind :: Value ( mutbl) ) ) ,
@@ -2638,7 +2647,11 @@ impl Param {
26382647 attrs,
26392648 pat : P ( Pat {
26402649 id : DUMMY_NODE_ID ,
2641- kind : PatKind :: Ident ( BindingMode ( ByRef :: No , mutbl) , eself_ident, None ) ,
2650+ kind : PatKind :: Ident (
2651+ BindingMode ( ByRef :: No , Pinnedness :: Not , mutbl) ,
2652+ eself_ident,
2653+ None ,
2654+ ) ,
26422655 span,
26432656 tokens : None ,
26442657 } ) ,
0 commit comments