@@ -719,14 +719,14 @@ pub struct PatField {
719
719
#[ derive( Clone , Copy , Debug , Eq , PartialEq ) ]
720
720
#[ derive( Encodable , Decodable , HashStable_Generic ) ]
721
721
pub enum ByRef {
722
- Yes ( Mutability ) ,
722
+ Yes ( Pinnedness , Mutability ) ,
723
723
No ,
724
724
}
725
725
726
726
impl ByRef {
727
727
#[ must_use]
728
728
pub fn cap_ref_mutability ( mut self , mutbl : Mutability ) -> Self {
729
- if let ByRef :: Yes ( old_mutbl) = & mut self {
729
+ if let ByRef :: Yes ( _ , old_mutbl) = & mut self {
730
730
* old_mutbl = cmp:: min ( * old_mutbl, mutbl) ;
731
731
}
732
732
self
@@ -744,20 +744,33 @@ pub struct BindingMode(pub ByRef, pub Mutability);
744
744
745
745
impl BindingMode {
746
746
pub const NONE : Self = Self ( ByRef :: No , Mutability :: Not ) ;
747
- pub const REF : Self = Self ( ByRef :: Yes ( Mutability :: Not ) , Mutability :: Not ) ;
747
+ pub const REF : Self = Self ( ByRef :: Yes ( Pinnedness :: Not , Mutability :: Not ) , Mutability :: Not ) ;
748
+ pub const REF_PIN : Self =
749
+ Self ( ByRef :: Yes ( Pinnedness :: Pinned , Mutability :: Not ) , Mutability :: Not ) ;
748
750
pub const MUT : Self = Self ( ByRef :: No , Mutability :: Mut ) ;
749
- pub const REF_MUT : Self = Self ( ByRef :: Yes ( Mutability :: Mut ) , Mutability :: Not ) ;
750
- pub const MUT_REF : Self = Self ( ByRef :: Yes ( Mutability :: Not ) , Mutability :: Mut ) ;
751
- pub const MUT_REF_MUT : Self = Self ( ByRef :: Yes ( Mutability :: Mut ) , Mutability :: Mut ) ;
751
+ pub const REF_MUT : Self = Self ( ByRef :: Yes ( Pinnedness :: Not , Mutability :: Mut ) , Mutability :: Not ) ;
752
+ pub const REF_PIN_MUT : Self =
753
+ Self ( ByRef :: Yes ( Pinnedness :: Pinned , Mutability :: Mut ) , Mutability :: Not ) ;
754
+ pub const MUT_REF : Self = Self ( ByRef :: Yes ( Pinnedness :: Not , Mutability :: Not ) , Mutability :: Mut ) ;
755
+ pub const MUT_REF_PIN : Self =
756
+ Self ( ByRef :: Yes ( Pinnedness :: Pinned , Mutability :: Not ) , Mutability :: Mut ) ;
757
+ pub const MUT_REF_MUT : Self =
758
+ Self ( ByRef :: Yes ( Pinnedness :: Not , Mutability :: Mut ) , Mutability :: Mut ) ;
759
+ pub const MUT_REF_PIN_MUT : Self =
760
+ Self ( ByRef :: Yes ( Pinnedness :: Pinned , Mutability :: Mut ) , Mutability :: Mut ) ;
752
761
753
762
pub fn prefix_str ( self ) -> & ' static str {
754
763
match self {
755
764
Self :: NONE => "" ,
756
765
Self :: REF => "ref " ,
766
+ Self :: REF_PIN => "ref pin const " ,
757
767
Self :: MUT => "mut " ,
758
768
Self :: REF_MUT => "ref mut " ,
769
+ Self :: REF_PIN_MUT => "ref pin mut " ,
759
770
Self :: MUT_REF => "mut ref " ,
771
+ Self :: MUT_REF_PIN => "mut ref pin " ,
760
772
Self :: MUT_REF_MUT => "mut ref mut " ,
773
+ Self :: MUT_REF_PIN_MUT => "mut ref pin mut " ,
761
774
}
762
775
}
763
776
}
0 commit comments