@@ -640,7 +640,7 @@ struct Binding<'tcx> {
640640 var_id : NodeId ,
641641 var_ty : Ty < ' tcx > ,
642642 mutability : Mutability ,
643- binding_mode : BindingMode < ' tcx > ,
643+ binding_mode : BindingMode ,
644644}
645645
646646/// Indicates that the type of `source` must be a subtype of the
@@ -1369,7 +1369,7 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> {
13691369 // Assign each of the bindings. Since we are binding for a
13701370 // guard expression, this will never trigger moves out of the
13711371 // candidate.
1372- let re_empty = self . hir . tcx ( ) . types . re_empty ;
1372+ let re_erased = self . hir . tcx ( ) . types . re_erased ;
13731373 for binding in bindings {
13741374 let source_info = self . source_info ( binding. span ) ;
13751375
@@ -1385,11 +1385,11 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> {
13851385 self . schedule_drop_for_binding ( binding. var_id , binding. span , RefWithinGuard ) ;
13861386 match binding. binding_mode {
13871387 BindingMode :: ByValue => {
1388- let rvalue = Rvalue :: Ref ( re_empty , BorrowKind :: Shared , binding. source . clone ( ) ) ;
1388+ let rvalue = Rvalue :: Ref ( re_erased , BorrowKind :: Shared , binding. source . clone ( ) ) ;
13891389 self . cfg
13901390 . push_assign ( block, source_info, & ref_for_guard, rvalue) ;
13911391 }
1392- BindingMode :: ByRef ( region , borrow_kind) => {
1392+ BindingMode :: ByRef ( borrow_kind) => {
13931393 // Tricky business: For `ref id` and `ref mut id`
13941394 // patterns, we want `id` within the guard to
13951395 // correspond to a temp of type `& &T` or `& &mut
@@ -1429,10 +1429,10 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> {
14291429 allow_two_phase_borrow : true ,
14301430 } ,
14311431 } ;
1432- let rvalue = Rvalue :: Ref ( region , borrow_kind, binding. source . clone ( ) ) ;
1432+ let rvalue = Rvalue :: Ref ( re_erased , borrow_kind, binding. source . clone ( ) ) ;
14331433 self . cfg
14341434 . push_assign ( block, source_info, & val_for_guard, rvalue) ;
1435- let rvalue = Rvalue :: Ref ( region , BorrowKind :: Shared , val_for_guard) ;
1435+ let rvalue = Rvalue :: Ref ( re_erased , BorrowKind :: Shared , val_for_guard) ;
14361436 self . cfg
14371437 . push_assign ( block, source_info, & ref_for_guard, rvalue) ;
14381438 }
@@ -1450,6 +1450,8 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> {
14501450 block, bindings
14511451 ) ;
14521452
1453+
1454+ let re_erased = self . hir . tcx ( ) . types . re_erased ;
14531455 // Assign each of the bindings. This may trigger moves out of the candidate.
14541456 for binding in bindings {
14551457 let source_info = self . source_info ( binding. span ) ;
@@ -1460,8 +1462,8 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> {
14601462 BindingMode :: ByValue => {
14611463 Rvalue :: Use ( self . consume_by_copy_or_move ( binding. source . clone ( ) ) )
14621464 }
1463- BindingMode :: ByRef ( region , borrow_kind) => {
1464- Rvalue :: Ref ( region , borrow_kind, binding. source . clone ( ) )
1465+ BindingMode :: ByRef ( borrow_kind) => {
1466+ Rvalue :: Ref ( re_erased , borrow_kind, binding. source . clone ( ) )
14651467 }
14661468 } ;
14671469 self . cfg . push_assign ( block, source_info, & local, rvalue) ;
@@ -1507,7 +1509,7 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> {
15071509 let tcx = self . hir . tcx ( ) ;
15081510 let binding_mode = match mode {
15091511 BindingMode :: ByValue => ty:: BindingMode :: BindByValue ( mutability. into ( ) ) ,
1510- BindingMode :: ByRef { .. } => ty:: BindingMode :: BindByReference ( mutability. into ( ) ) ,
1512+ BindingMode :: ByRef ( _ ) => ty:: BindingMode :: BindByReference ( mutability. into ( ) ) ,
15111513 } ;
15121514 debug ! ( "declare_binding: user_ty={:?}" , user_ty) ;
15131515 let local = LocalDecl :: < ' tcx > {
@@ -1545,7 +1547,7 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> {
15451547 let ref_for_guard = self . local_decls . push ( LocalDecl :: < ' tcx > {
15461548 // See previous comment.
15471549 mutability : Mutability :: Not ,
1548- ty : tcx. mk_imm_ref ( tcx. types . re_empty , var_ty) ,
1550+ ty : tcx. mk_imm_ref ( tcx. types . re_erased , var_ty) ,
15491551 user_ty : UserTypeProjections :: none ( ) ,
15501552 name : Some ( name) ,
15511553 source_info,
@@ -1614,7 +1616,7 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> {
16141616
16151617 for ( matched_place, borrow_kind) in all_fake_borrows {
16161618 let borrowed_input =
1617- Rvalue :: Ref ( tcx. types . re_empty , borrow_kind, matched_place. clone ( ) ) ;
1619+ Rvalue :: Ref ( tcx. types . re_erased , borrow_kind, matched_place. clone ( ) ) ;
16181620 let borrowed_input_ty = borrowed_input. ty ( & self . local_decls , tcx) ;
16191621 let borrowed_input_temp = self . temp ( borrowed_input_ty, source_info. span ) ;
16201622 self . cfg . push_assign (
0 commit comments