@@ -568,7 +568,7 @@ impl Pat {
568568 // In a type expression `_` is an inference variable.
569569 PatKind :: Wild => TyKind :: Infer ,
570570 // 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 ) => {
572572 TyKind :: Path ( None , Path :: from_ident ( * ident) )
573573 }
574574 PatKind :: Path ( qself, path) => TyKind :: Path ( qself. clone ( ) , path. clone ( ) ) ,
@@ -675,7 +675,7 @@ impl Pat {
675675 pub fn descr ( & self ) -> Option < String > {
676676 match & self . kind {
677677 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}" ) ) ,
679679 PatKind :: Ref ( pat, mutbl) => pat. descr ( ) . map ( |d| format ! ( "&{}{d}" , mutbl. prefix_str( ) ) ) ,
680680 _ => None ,
681681 }
@@ -716,14 +716,14 @@ impl ByRef {
716716 }
717717}
718718
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.
722722#[ derive( Clone , Copy , Debug , Eq , PartialEq ) ]
723723#[ derive( Encodable , Decodable , HashStable_Generic ) ]
724- pub struct BindingAnnotation ( pub ByRef , pub Mutability ) ;
724+ pub struct BindingMode ( pub ByRef , pub Mutability ) ;
725725
726- impl BindingAnnotation {
726+ impl BindingMode {
727727 pub const NONE : Self = Self ( ByRef :: No , Mutability :: Not ) ;
728728 pub const REF : Self = Self ( ByRef :: Yes ( Mutability :: Not ) , Mutability :: Not ) ;
729729 pub const MUT : Self = Self ( ByRef :: No , Mutability :: Mut ) ;
@@ -771,7 +771,7 @@ pub enum PatKind {
771771 /// or a unit struct/variant pattern, or a const pattern (in the last two cases the third
772772 /// field must be `None`). Disambiguation cannot be done with parser alone, so it happens
773773 /// during name resolution.
774- Ident ( BindingAnnotation , Ident , Option < P < Pat > > ) ,
774+ Ident ( BindingMode , Ident , Option < P < Pat > > ) ,
775775
776776 /// A struct or struct variant pattern (e.g., `Variant {x, y, ..}`).
777777 Struct ( Option < P < QSelf > > , Path , ThinVec < PatField > , PatFieldsRest ) ,
@@ -2384,7 +2384,7 @@ pub type ExplicitSelf = Spanned<SelfKind>;
23842384impl Param {
23852385 /// Attempts to cast parameter to `ExplicitSelf`.
23862386 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 {
23882388 if ident. name == kw:: SelfLower {
23892389 return match self . ty . kind {
23902390 TyKind :: ImplicitSelf => Some ( respan ( self . pat . span , SelfKind :: Value ( mutbl) ) ) ,
@@ -2436,7 +2436,7 @@ impl Param {
24362436 attrs,
24372437 pat : P ( Pat {
24382438 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 ) ,
24402440 span,
24412441 tokens : None ,
24422442 } ) ,
0 commit comments