@@ -553,7 +553,8 @@ impl<'a, 'b, 'gcx, 'tcx> TypeVerifier<'a, 'b, 'gcx, 'tcx> {
553553 }
554554 }
555555 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) ;
557558 if index_ty != tcx. types . usize {
558559 PlaceTy :: Ty {
559560 ty : span_mirbug_and_err ! ( self , i, "index by non-usize {:?}" , i) ,
@@ -1257,7 +1258,8 @@ impl<'a, 'gcx, 'tcx> TypeChecker<'a, 'gcx, 'tcx> {
12571258 _ => ConstraintCategory :: Assignment ,
12581259 } ;
12591260
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) ;
12611263 let rv_ty = rv. ty ( mir, tcx) ;
12621264 if let Err ( terr) =
12631265 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> {
13091311 ref place,
13101312 variant_index,
13111313 } => {
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) ;
13131316 let adt = match place_type. sty {
13141317 TyKind :: Adt ( adt, _) if adt. is_enum ( ) => adt,
13151318 _ => {
@@ -1331,7 +1334,8 @@ impl<'a, 'gcx, 'tcx> TypeChecker<'a, 'gcx, 'tcx> {
13311334 } ;
13321335 }
13331336 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) ;
13351339 if let Err ( terr) = self . relate_type_and_user_type (
13361340 place_ty,
13371341 variance,
@@ -1387,7 +1391,8 @@ impl<'a, 'gcx, 'tcx> TypeChecker<'a, 'gcx, 'tcx> {
13871391 target : _,
13881392 unwind : _,
13891393 } => {
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) ;
13911396 let rv_ty = value. ty ( mir, tcx) ;
13921397
13931398 let locations = term_location. to_locations ( ) ;
@@ -1535,7 +1540,8 @@ impl<'a, 'gcx, 'tcx> TypeChecker<'a, 'gcx, 'tcx> {
15351540 let tcx = self . tcx ( ) ;
15361541 match * destination {
15371542 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) ;
15391545 let category = match * dest {
15401546 Place :: Local ( RETURN_PLACE ) => {
15411547 if let Some ( BorrowCheckContext {
@@ -2137,7 +2143,8 @@ impl<'a, 'gcx, 'tcx> TypeChecker<'a, 'gcx, 'tcx> {
21372143 match * elem {
21382144 ProjectionElem :: Deref => {
21392145 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) ;
21412148
21422149 debug ! ( "add_reborrow_constraint - base_ty = {:?}" , base_ty) ;
21432150 match base_ty. sty {
0 commit comments