@@ -568,7 +568,7 @@ impl Pat {
568
568
// In a type expression `_` is an inference variable.
569
569
PatKind :: Wild => TyKind :: Infer ,
570
570
// An IDENT pattern with no binding mode would be valid as path to a type. E.g. `u32`.
571
- PatKind :: Ident ( BindingAnnotation :: NONE , ident, None ) => {
571
+ PatKind :: Ident ( BindingMode :: NONE , ident, None ) => {
572
572
TyKind :: Path ( None , Path :: from_ident ( * ident) )
573
573
}
574
574
PatKind :: Path ( qself, path) => TyKind :: Path ( qself. clone ( ) , path. clone ( ) ) ,
@@ -675,7 +675,7 @@ impl Pat {
675
675
pub fn descr ( & self ) -> Option < String > {
676
676
match & self . kind {
677
677
PatKind :: Wild => Some ( "_" . to_string ( ) ) ,
678
- PatKind :: Ident ( BindingAnnotation :: NONE , ident, None ) => Some ( format ! ( "{ident}" ) ) ,
678
+ PatKind :: Ident ( BindingMode :: NONE , ident, None ) => Some ( format ! ( "{ident}" ) ) ,
679
679
PatKind :: Ref ( pat, mutbl) => pat. descr ( ) . map ( |d| format ! ( "&{}{d}" , mutbl. prefix_str( ) ) ) ,
680
680
_ => None ,
681
681
}
@@ -716,14 +716,14 @@ impl ByRef {
716
716
}
717
717
}
718
718
719
- /// Explicit binding annotations given in the HIR for a binding. Note
720
- /// that this is not the final binding *mode* that we infer after type
721
- /// inference.
719
+ /// The mode of a binding (`mut`, `ref mut`, etc).
720
+ /// Used for both the wxplicit binding annotations given in the HIR for a binding
721
+ /// and the final binding *mode* that we infer after type inference.
722
722
#[ derive( Clone , Copy , Debug , Eq , PartialEq ) ]
723
723
#[ derive( Encodable , Decodable , HashStable_Generic ) ]
724
- pub struct BindingAnnotation ( pub ByRef , pub Mutability ) ;
724
+ pub struct BindingMode ( pub ByRef , pub Mutability ) ;
725
725
726
- impl BindingAnnotation {
726
+ impl BindingMode {
727
727
pub const NONE : Self = Self ( ByRef :: No , Mutability :: Not ) ;
728
728
pub const REF : Self = Self ( ByRef :: Yes ( Mutability :: Not ) , Mutability :: Not ) ;
729
729
pub const MUT : Self = Self ( ByRef :: No , Mutability :: Mut ) ;
@@ -771,7 +771,7 @@ pub enum PatKind {
771
771
/// or a unit struct/variant pattern, or a const pattern (in the last two cases the third
772
772
/// field must be `None`). Disambiguation cannot be done with parser alone, so it happens
773
773
/// during name resolution.
774
- Ident ( BindingAnnotation , Ident , Option < P < Pat > > ) ,
774
+ Ident ( BindingMode , Ident , Option < P < Pat > > ) ,
775
775
776
776
/// A struct or struct variant pattern (e.g., `Variant {x, y, ..}`).
777
777
Struct ( Option < P < QSelf > > , Path , ThinVec < PatField > , PatFieldsRest ) ,
@@ -2384,7 +2384,7 @@ pub type ExplicitSelf = Spanned<SelfKind>;
2384
2384
impl Param {
2385
2385
/// Attempts to cast parameter to `ExplicitSelf`.
2386
2386
pub fn to_self ( & self ) -> Option < ExplicitSelf > {
2387
- if let PatKind :: Ident ( BindingAnnotation ( ByRef :: No , mutbl) , ident, _) = self . pat . kind {
2387
+ if let PatKind :: Ident ( BindingMode ( ByRef :: No , mutbl) , ident, _) = self . pat . kind {
2388
2388
if ident. name == kw:: SelfLower {
2389
2389
return match self . ty . kind {
2390
2390
TyKind :: ImplicitSelf => Some ( respan ( self . pat . span , SelfKind :: Value ( mutbl) ) ) ,
@@ -2436,7 +2436,7 @@ impl Param {
2436
2436
attrs,
2437
2437
pat : P ( Pat {
2438
2438
id : DUMMY_NODE_ID ,
2439
- kind : PatKind :: Ident ( BindingAnnotation ( ByRef :: No , mutbl) , eself_ident, None ) ,
2439
+ kind : PatKind :: Ident ( BindingMode ( ByRef :: No , mutbl) , eself_ident, None ) ,
2440
2440
span,
2441
2441
tokens : None ,
2442
2442
} ) ,
0 commit comments