@@ -1280,7 +1280,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
1280
1280
& mut self ,
1281
1281
fake_borrows : & ' b FxHashSet < Place < ' tcx > > ,
1282
1282
temp_span : Span ,
1283
- ) -> Vec < ( Place < ' tcx > , Local ) > {
1283
+ ) -> Vec < ( PlaceRef < ' b , ' tcx > , Local ) > {
1284
1284
let tcx = self . hir . tcx ( ) ;
1285
1285
1286
1286
debug ! ( "add_fake_borrows fake_borrows = {:?}" , fake_borrows) ;
@@ -1296,15 +1296,15 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
1296
1296
// Insert a shallow borrow after a deref. For other
1297
1297
// projections the borrow of prefix_cursor will
1298
1298
// conflict with any mutation of base.
1299
- all_fake_borrows. push ( Place {
1300
- base : place. base . clone ( ) ,
1301
- projection : base. clone ( ) ,
1299
+ all_fake_borrows. push ( PlaceRef {
1300
+ base : & place. base ,
1301
+ projection : base,
1302
1302
} ) ;
1303
1303
}
1304
1304
prefix_cursor = base;
1305
1305
}
1306
1306
1307
- all_fake_borrows. push ( place. clone ( ) ) ;
1307
+ all_fake_borrows. push ( place. as_place_ref ( ) ) ;
1308
1308
}
1309
1309
1310
1310
// Deduplicate and ensure a deterministic order.
@@ -1314,7 +1314,13 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
1314
1314
debug ! ( "add_fake_borrows all_fake_borrows = {:?}" , all_fake_borrows) ;
1315
1315
1316
1316
all_fake_borrows. into_iter ( ) . map ( |matched_place| {
1317
- let fake_borrow_deref_ty = matched_place. ty ( & self . local_decls , tcx) . ty ;
1317
+ let fake_borrow_deref_ty = Place :: ty_from (
1318
+ matched_place. base ,
1319
+ matched_place. projection ,
1320
+ & self . local_decls ,
1321
+ tcx,
1322
+ )
1323
+ . ty ;
1318
1324
let fake_borrow_ty = tcx. mk_imm_ref ( tcx. lifetimes . re_erased , fake_borrow_deref_ty) ;
1319
1325
let fake_borrow_temp = self . local_decls . push (
1320
1326
LocalDecl :: new_temp ( fake_borrow_ty, temp_span)
@@ -1345,7 +1351,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
1345
1351
& mut self ,
1346
1352
candidate : Candidate < ' pat , ' tcx > ,
1347
1353
guard : Option < Guard < ' tcx > > ,
1348
- fake_borrows : & Vec < ( Place < ' tcx > , Local ) > ,
1354
+ fake_borrows : & Vec < ( PlaceRef < ' _ , ' tcx > , Local ) > ,
1349
1355
scrutinee_span : Span ,
1350
1356
region_scope : region:: Scope ,
1351
1357
) -> BasicBlock {
@@ -1480,7 +1486,10 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
1480
1486
let borrow = Rvalue :: Ref (
1481
1487
re_erased,
1482
1488
BorrowKind :: Shallow ,
1483
- place. clone ( ) ,
1489
+ Place {
1490
+ base : place. base . clone ( ) ,
1491
+ projection : place. projection . clone ( ) ,
1492
+ } ,
1484
1493
) ;
1485
1494
self . cfg . push_assign (
1486
1495
block,
0 commit comments