44use core:: ops:: ControlFlow ;
55use hir:: { ExprKind , Param } ;
66use rustc_errors:: { Applicability , Diag } ;
7- use rustc_hir as hir;
87use rustc_hir:: intravisit:: Visitor ;
9- use rustc_hir:: Node ;
8+ use rustc_hir:: { self as hir , BindingAnnotation , ByRef , Node } ;
109use rustc_infer:: traits;
1110use rustc_middle:: mir:: { Mutability , Place , PlaceRef , ProjectionElem } ;
1211use rustc_middle:: ty:: { self , InstanceDef , ToPredicate , Ty , TyCtxt } ;
@@ -304,7 +303,7 @@ impl<'a, 'tcx> MirBorrowckCtxt<'a, 'tcx> {
304303 {
305304 match * decl. local_info ( ) {
306305 LocalInfo :: User ( BindingForm :: Var ( mir:: VarBindingForm {
307- binding_mode : ty :: BindingMode :: BindByValue ( Mutability :: Not ) ,
306+ binding_mode : BindingAnnotation ( ByRef :: No , Mutability :: Not ) ,
308307 opt_ty_info : Some ( sp) ,
309308 opt_match_place : _,
310309 pat_span : _,
@@ -342,7 +341,7 @@ impl<'a, 'tcx> MirBorrowckCtxt<'a, 'tcx> {
342341 } else if decl. mutability . is_not ( ) {
343342 if matches ! (
344343 decl. local_info( ) ,
345- LocalInfo :: User ( BindingForm :: ImplicitSelf ( hir:: ImplicitSelfKind :: MutRef ) )
344+ LocalInfo :: User ( BindingForm :: ImplicitSelf ( hir:: ImplicitSelfKind :: RefMut ) )
346345 ) {
347346 err. note (
348347 "as `Self` may be unsized, this call attempts to take `&mut &mut self`" ,
@@ -407,7 +406,7 @@ impl<'a, 'tcx> MirBorrowckCtxt<'a, 'tcx> {
407406 if let Some ( fn_decl) = node. fn_decl ( ) {
408407 if !matches ! (
409408 fn_decl. implicit_self,
410- hir:: ImplicitSelfKind :: ImmRef | hir:: ImplicitSelfKind :: MutRef
409+ hir:: ImplicitSelfKind :: RefImm | hir:: ImplicitSelfKind :: RefMut
411410 ) {
412411 err. span_suggestion (
413412 upvar_ident. span ,
@@ -717,7 +716,7 @@ impl<'a, 'tcx> MirBorrowckCtxt<'a, 'tcx> {
717716 debug ! ( "local_decl: {:?}" , local_decl) ;
718717 let pat_span = match * local_decl. local_info ( ) {
719718 LocalInfo :: User ( BindingForm :: Var ( mir:: VarBindingForm {
720- binding_mode : ty :: BindingMode :: BindByValue ( Mutability :: Not ) ,
719+ binding_mode : BindingAnnotation ( ByRef :: No , Mutability :: Not ) ,
721720 opt_ty_info : _,
722721 opt_match_place : _,
723722 pat_span,
@@ -1070,7 +1069,7 @@ impl<'a, 'tcx> MirBorrowckCtxt<'a, 'tcx> {
10701069 }
10711070
10721071 LocalInfo :: User ( mir:: BindingForm :: Var ( mir:: VarBindingForm {
1073- binding_mode : ty :: BindingMode :: BindByValue ( _) ,
1072+ binding_mode : BindingAnnotation ( ByRef :: No , _) ,
10741073 opt_ty_info,
10751074 ..
10761075 } ) ) => {
@@ -1138,7 +1137,7 @@ impl<'a, 'tcx> MirBorrowckCtxt<'a, 'tcx> {
11381137 }
11391138
11401139 LocalInfo :: User ( mir:: BindingForm :: Var ( mir:: VarBindingForm {
1141- binding_mode : ty :: BindingMode :: BindByReference ( _) ,
1140+ binding_mode : BindingAnnotation ( ByRef :: Yes ( _ ) , _) ,
11421141 ..
11431142 } ) ) => {
11441143 let pattern_span: Span = local_decl. source_info . span ;
@@ -1329,7 +1328,7 @@ pub fn mut_borrow_of_mutable_ref(local_decl: &LocalDecl<'_>, local_name: Option<
13291328 match * local_decl. local_info ( ) {
13301329 // Check if mutably borrowing a mutable reference.
13311330 LocalInfo :: User ( mir:: BindingForm :: Var ( mir:: VarBindingForm {
1332- binding_mode : ty :: BindingMode :: BindByValue ( Mutability :: Not ) ,
1331+ binding_mode : BindingAnnotation ( ByRef :: No , Mutability :: Not ) ,
13331332 ..
13341333 } ) ) => matches ! ( local_decl. ty. kind( ) , ty:: Ref ( _, _, hir:: Mutability :: Mut ) ) ,
13351334 LocalInfo :: User ( mir:: BindingForm :: ImplicitSelf ( kind) ) => {
@@ -1338,7 +1337,7 @@ pub fn mut_borrow_of_mutable_ref(local_decl: &LocalDecl<'_>, local_name: Option<
13381337 //
13391338 // Deliberately fall into this case for all implicit self types,
13401339 // so that we don't fall into the next case with them.
1341- kind == hir:: ImplicitSelfKind :: MutRef
1340+ kind == hir:: ImplicitSelfKind :: RefMut
13421341 }
13431342 _ if Some ( kw:: SelfLower ) == local_name => {
13441343 // Otherwise, check if the name is the `self` keyword - in which case
0 commit comments