@@ -617,7 +617,7 @@ struct Binding<'tcx> {
617
617
var_id : NodeId ,
618
618
var_ty : Ty < ' tcx > ,
619
619
mutability : Mutability ,
620
- binding_mode : BindingMode < ' tcx > ,
620
+ binding_mode : BindingMode ,
621
621
}
622
622
623
623
/// Indicates that the type of `source` must be a subtype of the
@@ -1345,7 +1345,7 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> {
1345
1345
// Assign each of the bindings. Since we are binding for a
1346
1346
// guard expression, this will never trigger moves out of the
1347
1347
// candidate.
1348
- let re_empty = self . hir . tcx ( ) . types . re_empty ;
1348
+ let re_erased = self . hir . tcx ( ) . types . re_erased ;
1349
1349
for binding in bindings {
1350
1350
let source_info = self . source_info ( binding. span ) ;
1351
1351
@@ -1361,11 +1361,11 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> {
1361
1361
self . schedule_drop_for_binding ( binding. var_id , binding. span , RefWithinGuard ) ;
1362
1362
match binding. binding_mode {
1363
1363
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 ( ) ) ;
1365
1365
self . cfg
1366
1366
. push_assign ( block, source_info, & ref_for_guard, rvalue) ;
1367
1367
}
1368
- BindingMode :: ByRef ( region , borrow_kind) => {
1368
+ BindingMode :: ByRef ( borrow_kind) => {
1369
1369
// Tricky business: For `ref id` and `ref mut id`
1370
1370
// patterns, we want `id` within the guard to
1371
1371
// correspond to a temp of type `& &T` or `& &mut
@@ -1405,10 +1405,10 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> {
1405
1405
allow_two_phase_borrow : true ,
1406
1406
} ,
1407
1407
} ;
1408
- let rvalue = Rvalue :: Ref ( region , borrow_kind, binding. source . clone ( ) ) ;
1408
+ let rvalue = Rvalue :: Ref ( re_erased , borrow_kind, binding. source . clone ( ) ) ;
1409
1409
self . cfg
1410
1410
. 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) ;
1412
1412
self . cfg
1413
1413
. push_assign ( block, source_info, & ref_for_guard, rvalue) ;
1414
1414
}
@@ -1426,6 +1426,8 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> {
1426
1426
block, bindings
1427
1427
) ;
1428
1428
1429
+
1430
+ let re_erased = self . hir . tcx ( ) . types . re_erased ;
1429
1431
// Assign each of the bindings. This may trigger moves out of the candidate.
1430
1432
for binding in bindings {
1431
1433
let source_info = self . source_info ( binding. span ) ;
@@ -1436,8 +1438,8 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> {
1436
1438
BindingMode :: ByValue => {
1437
1439
Rvalue :: Use ( self . consume_by_copy_or_move ( binding. source . clone ( ) ) )
1438
1440
}
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 ( ) )
1441
1443
}
1442
1444
} ;
1443
1445
self . cfg . push_assign ( block, source_info, & local, rvalue) ;
@@ -1483,7 +1485,7 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> {
1483
1485
let tcx = self . hir . tcx ( ) ;
1484
1486
let binding_mode = match mode {
1485
1487
BindingMode :: ByValue => ty:: BindingMode :: BindByValue ( mutability. into ( ) ) ,
1486
- BindingMode :: ByRef { .. } => ty:: BindingMode :: BindByReference ( mutability. into ( ) ) ,
1488
+ BindingMode :: ByRef ( _ ) => ty:: BindingMode :: BindByReference ( mutability. into ( ) ) ,
1487
1489
} ;
1488
1490
debug ! ( "declare_binding: user_ty={:?}" , user_ty) ;
1489
1491
let local = LocalDecl :: < ' tcx > {
@@ -1521,7 +1523,7 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> {
1521
1523
let ref_for_guard = self . local_decls . push ( LocalDecl :: < ' tcx > {
1522
1524
// See previous comment.
1523
1525
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) ,
1525
1527
user_ty : UserTypeProjections :: none ( ) ,
1526
1528
name : Some ( name) ,
1527
1529
source_info,
@@ -1590,7 +1592,7 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> {
1590
1592
1591
1593
for ( matched_place, borrow_kind) in all_fake_borrows {
1592
1594
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 ( ) ) ;
1594
1596
let borrowed_input_ty = borrowed_input. ty ( & self . local_decls , tcx) ;
1595
1597
let borrowed_input_temp = self . temp ( borrowed_input_ty, source_info. span ) ;
1596
1598
self . cfg . push_assign (
0 commit comments