@@ -553,7 +553,8 @@ impl<'a, 'b, 'gcx, 'tcx> TypeVerifier<'a, 'b, 'gcx, 'tcx> {
553
553
}
554
554
}
555
555
ProjectionElem :: Index ( i) => {
556
- let index_ty = Place :: Local ( i) . ty ( self . mir , tcx) . to_ty ( tcx) ;
556
+ let neo_place = tcx. as_new_place ( & Place :: Local ( i) ) ;
557
+ let index_ty = neo_place. ty ( self . mir , tcx) . to_ty ( tcx) ;
557
558
if index_ty != tcx. types . usize {
558
559
PlaceTy :: Ty {
559
560
ty : span_mirbug_and_err ! ( self , i, "index by non-usize {:?}" , i) ,
@@ -1257,7 +1258,8 @@ impl<'a, 'gcx, 'tcx> TypeChecker<'a, 'gcx, 'tcx> {
1257
1258
_ => ConstraintCategory :: Assignment ,
1258
1259
} ;
1259
1260
1260
- let place_ty = place. ty ( mir, tcx) . to_ty ( tcx) ;
1261
+ let neo_place = tcx. as_new_place ( place) ;
1262
+ let place_ty = neo_place. ty ( mir, tcx) . to_ty ( tcx) ;
1261
1263
let rv_ty = rv. ty ( mir, tcx) ;
1262
1264
if let Err ( terr) =
1263
1265
self . sub_types_or_anon ( rv_ty, place_ty, location. to_locations ( ) , category)
@@ -1309,7 +1311,8 @@ impl<'a, 'gcx, 'tcx> TypeChecker<'a, 'gcx, 'tcx> {
1309
1311
ref place,
1310
1312
variant_index,
1311
1313
} => {
1312
- let place_type = place. ty ( mir, tcx) . to_ty ( tcx) ;
1314
+ let neo_place = tcx. as_new_place ( place) ;
1315
+ let place_type = neo_place. ty ( mir, tcx) . to_ty ( tcx) ;
1313
1316
let adt = match place_type. sty {
1314
1317
TyKind :: Adt ( adt, _) if adt. is_enum ( ) => adt,
1315
1318
_ => {
@@ -1331,7 +1334,8 @@ impl<'a, 'gcx, 'tcx> TypeChecker<'a, 'gcx, 'tcx> {
1331
1334
} ;
1332
1335
}
1333
1336
StatementKind :: AscribeUserType ( ref place, variance, box ref projection) => {
1334
- let place_ty = place. ty ( mir, tcx) . to_ty ( tcx) ;
1337
+ let neo_place = tcx. as_new_place ( place) ;
1338
+ let place_ty = neo_place. ty ( mir, tcx) . to_ty ( tcx) ;
1335
1339
if let Err ( terr) = self . relate_type_and_user_type (
1336
1340
place_ty,
1337
1341
variance,
@@ -1387,7 +1391,8 @@ impl<'a, 'gcx, 'tcx> TypeChecker<'a, 'gcx, 'tcx> {
1387
1391
target : _,
1388
1392
unwind : _,
1389
1393
} => {
1390
- let place_ty = location. ty ( mir, tcx) . to_ty ( tcx) ;
1394
+ let neo_place = tcx. as_new_place ( location) ;
1395
+ let place_ty = neo_place. ty ( mir, tcx) . to_ty ( tcx) ;
1391
1396
let rv_ty = value. ty ( mir, tcx) ;
1392
1397
1393
1398
let locations = term_location. to_locations ( ) ;
@@ -1535,7 +1540,8 @@ impl<'a, 'gcx, 'tcx> TypeChecker<'a, 'gcx, 'tcx> {
1535
1540
let tcx = self . tcx ( ) ;
1536
1541
match * destination {
1537
1542
Some ( ( ref dest, _target_block) ) => {
1538
- let dest_ty = dest. ty ( mir, tcx) . to_ty ( tcx) ;
1543
+ let neo_place = tcx. as_new_place ( dest) ;
1544
+ let dest_ty = neo_place. ty ( mir, tcx) . to_ty ( tcx) ;
1539
1545
let category = match * dest {
1540
1546
Place :: Local ( RETURN_PLACE ) => {
1541
1547
if let Some ( BorrowCheckContext {
@@ -2137,7 +2143,8 @@ impl<'a, 'gcx, 'tcx> TypeChecker<'a, 'gcx, 'tcx> {
2137
2143
match * elem {
2138
2144
ProjectionElem :: Deref => {
2139
2145
let tcx = self . infcx . tcx ;
2140
- let base_ty = base. ty ( self . mir , tcx) . to_ty ( tcx) ;
2146
+ let neo_base = tcx. as_new_place ( base) ;
2147
+ let base_ty = neo_base. ty ( self . mir , tcx) . to_ty ( tcx) ;
2141
2148
2142
2149
debug ! ( "add_reborrow_constraint - base_ty = {:?}" , base_ty) ;
2143
2150
match base_ty. sty {
0 commit comments