@@ -640,7 +640,7 @@ struct Binding<'tcx> {
640
640
var_id : NodeId ,
641
641
var_ty : Ty < ' tcx > ,
642
642
mutability : Mutability ,
643
- binding_mode : BindingMode < ' tcx > ,
643
+ binding_mode : BindingMode ,
644
644
}
645
645
646
646
/// Indicates that the type of `source` must be a subtype of the
@@ -1369,7 +1369,7 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> {
1369
1369
// Assign each of the bindings. Since we are binding for a
1370
1370
// guard expression, this will never trigger moves out of the
1371
1371
// candidate.
1372
- let re_empty = self . hir . tcx ( ) . types . re_empty ;
1372
+ let re_erased = self . hir . tcx ( ) . types . re_erased ;
1373
1373
for binding in bindings {
1374
1374
let source_info = self . source_info ( binding. span ) ;
1375
1375
@@ -1385,11 +1385,11 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> {
1385
1385
self . schedule_drop_for_binding ( binding. var_id , binding. span , RefWithinGuard ) ;
1386
1386
match binding. binding_mode {
1387
1387
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 ( ) ) ;
1389
1389
self . cfg
1390
1390
. push_assign ( block, source_info, & ref_for_guard, rvalue) ;
1391
1391
}
1392
- BindingMode :: ByRef ( region , borrow_kind) => {
1392
+ BindingMode :: ByRef ( borrow_kind) => {
1393
1393
// Tricky business: For `ref id` and `ref mut id`
1394
1394
// patterns, we want `id` within the guard to
1395
1395
// correspond to a temp of type `& &T` or `& &mut
@@ -1429,10 +1429,10 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> {
1429
1429
allow_two_phase_borrow : true ,
1430
1430
} ,
1431
1431
} ;
1432
- let rvalue = Rvalue :: Ref ( region , borrow_kind, binding. source . clone ( ) ) ;
1432
+ let rvalue = Rvalue :: Ref ( re_erased , borrow_kind, binding. source . clone ( ) ) ;
1433
1433
self . cfg
1434
1434
. 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) ;
1436
1436
self . cfg
1437
1437
. push_assign ( block, source_info, & ref_for_guard, rvalue) ;
1438
1438
}
@@ -1450,6 +1450,8 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> {
1450
1450
block, bindings
1451
1451
) ;
1452
1452
1453
+
1454
+ let re_erased = self . hir . tcx ( ) . types . re_erased ;
1453
1455
// Assign each of the bindings. This may trigger moves out of the candidate.
1454
1456
for binding in bindings {
1455
1457
let source_info = self . source_info ( binding. span ) ;
@@ -1460,8 +1462,8 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> {
1460
1462
BindingMode :: ByValue => {
1461
1463
Rvalue :: Use ( self . consume_by_copy_or_move ( binding. source . clone ( ) ) )
1462
1464
}
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 ( ) )
1465
1467
}
1466
1468
} ;
1467
1469
self . cfg . push_assign ( block, source_info, & local, rvalue) ;
@@ -1507,7 +1509,7 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> {
1507
1509
let tcx = self . hir . tcx ( ) ;
1508
1510
let binding_mode = match mode {
1509
1511
BindingMode :: ByValue => ty:: BindingMode :: BindByValue ( mutability. into ( ) ) ,
1510
- BindingMode :: ByRef { .. } => ty:: BindingMode :: BindByReference ( mutability. into ( ) ) ,
1512
+ BindingMode :: ByRef ( _ ) => ty:: BindingMode :: BindByReference ( mutability. into ( ) ) ,
1511
1513
} ;
1512
1514
debug ! ( "declare_binding: user_ty={:?}" , user_ty) ;
1513
1515
let local = LocalDecl :: < ' tcx > {
@@ -1545,7 +1547,7 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> {
1545
1547
let ref_for_guard = self . local_decls . push ( LocalDecl :: < ' tcx > {
1546
1548
// See previous comment.
1547
1549
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) ,
1549
1551
user_ty : UserTypeProjections :: none ( ) ,
1550
1552
name : Some ( name) ,
1551
1553
source_info,
@@ -1614,7 +1616,7 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> {
1614
1616
1615
1617
for ( matched_place, borrow_kind) in all_fake_borrows {
1616
1618
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 ( ) ) ;
1618
1620
let borrowed_input_ty = borrowed_input. ty ( & self . local_decls , tcx) ;
1619
1621
let borrowed_input_temp = self . temp ( borrowed_input_ty, source_info. span ) ;
1620
1622
self . cfg . push_assign (
0 commit comments