@@ -617,7 +617,7 @@ struct Binding<'tcx> {
617617 var_id : NodeId ,
618618 var_ty : Ty < ' tcx > ,
619619 mutability : Mutability ,
620- binding_mode : BindingMode < ' tcx > ,
620+ binding_mode : BindingMode ,
621621}
622622
623623/// Indicates that the type of `source` must be a subtype of the
@@ -1345,7 +1345,7 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> {
13451345 // Assign each of the bindings. Since we are binding for a
13461346 // guard expression, this will never trigger moves out of the
13471347 // candidate.
1348- let re_empty = self . hir . tcx ( ) . types . re_empty ;
1348+ let re_erased = self . hir . tcx ( ) . types . re_erased ;
13491349 for binding in bindings {
13501350 let source_info = self . source_info ( binding. span ) ;
13511351
@@ -1361,11 +1361,11 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> {
13611361 self . schedule_drop_for_binding ( binding. var_id , binding. span , RefWithinGuard ) ;
13621362 match binding. binding_mode {
13631363 BindingMode :: ByValue => {
1364- let rvalue = Rvalue :: Ref ( re_empty , BorrowKind :: Shared , binding. source . clone ( ) ) ;
1364+ let rvalue = Rvalue :: Ref ( re_erased , BorrowKind :: Shared , binding. source . clone ( ) ) ;
13651365 self . cfg
13661366 . push_assign ( block, source_info, & ref_for_guard, rvalue) ;
13671367 }
1368- BindingMode :: ByRef ( region , borrow_kind) => {
1368+ BindingMode :: ByRef ( borrow_kind) => {
13691369 // Tricky business: For `ref id` and `ref mut id`
13701370 // patterns, we want `id` within the guard to
13711371 // correspond to a temp of type `& &T` or `& &mut
@@ -1405,10 +1405,10 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> {
14051405 allow_two_phase_borrow : true ,
14061406 } ,
14071407 } ;
1408- let rvalue = Rvalue :: Ref ( region , borrow_kind, binding. source . clone ( ) ) ;
1408+ let rvalue = Rvalue :: Ref ( re_erased , borrow_kind, binding. source . clone ( ) ) ;
14091409 self . cfg
14101410 . push_assign ( block, source_info, & val_for_guard, rvalue) ;
1411- let rvalue = Rvalue :: Ref ( region , BorrowKind :: Shared , val_for_guard) ;
1411+ let rvalue = Rvalue :: Ref ( re_erased , BorrowKind :: Shared , val_for_guard) ;
14121412 self . cfg
14131413 . push_assign ( block, source_info, & ref_for_guard, rvalue) ;
14141414 }
@@ -1426,6 +1426,8 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> {
14261426 block, bindings
14271427 ) ;
14281428
1429+
1430+ let re_erased = self . hir . tcx ( ) . types . re_erased ;
14291431 // Assign each of the bindings. This may trigger moves out of the candidate.
14301432 for binding in bindings {
14311433 let source_info = self . source_info ( binding. span ) ;
@@ -1436,8 +1438,8 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> {
14361438 BindingMode :: ByValue => {
14371439 Rvalue :: Use ( self . consume_by_copy_or_move ( binding. source . clone ( ) ) )
14381440 }
1439- BindingMode :: ByRef ( region , borrow_kind) => {
1440- Rvalue :: Ref ( region , borrow_kind, binding. source . clone ( ) )
1441+ BindingMode :: ByRef ( borrow_kind) => {
1442+ Rvalue :: Ref ( re_erased , borrow_kind, binding. source . clone ( ) )
14411443 }
14421444 } ;
14431445 self . cfg . push_assign ( block, source_info, & local, rvalue) ;
@@ -1483,7 +1485,7 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> {
14831485 let tcx = self . hir . tcx ( ) ;
14841486 let binding_mode = match mode {
14851487 BindingMode :: ByValue => ty:: BindingMode :: BindByValue ( mutability. into ( ) ) ,
1486- BindingMode :: ByRef { .. } => ty:: BindingMode :: BindByReference ( mutability. into ( ) ) ,
1488+ BindingMode :: ByRef ( _ ) => ty:: BindingMode :: BindByReference ( mutability. into ( ) ) ,
14871489 } ;
14881490 debug ! ( "declare_binding: user_ty={:?}" , user_ty) ;
14891491 let local = LocalDecl :: < ' tcx > {
@@ -1521,7 +1523,7 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> {
15211523 let ref_for_guard = self . local_decls . push ( LocalDecl :: < ' tcx > {
15221524 // See previous comment.
15231525 mutability : Mutability :: Not ,
1524- ty : tcx. mk_imm_ref ( tcx. types . re_empty , var_ty) ,
1526+ ty : tcx. mk_imm_ref ( tcx. types . re_erased , var_ty) ,
15251527 user_ty : UserTypeProjections :: none ( ) ,
15261528 name : Some ( name) ,
15271529 source_info,
@@ -1590,7 +1592,7 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> {
15901592
15911593 for ( matched_place, borrow_kind) in all_fake_borrows {
15921594 let borrowed_input =
1593- Rvalue :: Ref ( tcx. types . re_empty , borrow_kind, matched_place. clone ( ) ) ;
1595+ Rvalue :: Ref ( tcx. types . re_erased , borrow_kind, matched_place. clone ( ) ) ;
15941596 let borrowed_input_ty = borrowed_input. ty ( & self . local_decls , tcx) ;
15951597 let borrowed_input_temp = self . temp ( borrowed_input_ty, source_info. span ) ;
15961598 self . cfg . push_assign (
0 commit comments