@@ -5,7 +5,7 @@ use crate::const_eval::CanAccessStatics;
5
5
use crate :: interpret:: MPlaceTy ;
6
6
use crate :: interpret:: {
7
7
intern_const_alloc_recursive, ConstValue , ImmTy , Immediate , InternKind , MemPlaceMeta ,
8
- MemoryKind , PlaceTy , Projectable , Scalar ,
8
+ MemoryKind , Place , Projectable , Scalar ,
9
9
} ;
10
10
use rustc_middle:: ty:: { self , ScalarInt , Ty , TyCtxt } ;
11
11
use rustc_span:: source_map:: DUMMY_SP ;
@@ -280,7 +280,7 @@ pub fn valtree_to_const_value<'tcx>(
280
280
) ,
281
281
} ,
282
282
ty:: Ref ( _, _, _) | ty:: Tuple ( _) | ty:: Array ( _, _) | ty:: Adt ( ..) => {
283
- let mut place = match ty. kind ( ) {
283
+ let place = match ty. kind ( ) {
284
284
ty:: Ref ( _, inner_ty, _) => {
285
285
// Need to create a place for the pointee to fill for Refs
286
286
create_pointee_place ( & mut ecx, * inner_ty, valtree)
@@ -289,8 +289,8 @@ pub fn valtree_to_const_value<'tcx>(
289
289
} ;
290
290
debug ! ( ?place) ;
291
291
292
- valtree_into_mplace ( & mut ecx, & mut place, valtree) ;
293
- dump_place ( & ecx, place. clone ( ) . into ( ) ) ;
292
+ valtree_into_mplace ( & mut ecx, & place, valtree) ;
293
+ dump_place ( & ecx, & place) ;
294
294
intern_const_alloc_recursive ( & mut ecx, InternKind :: Constant , & place) . unwrap ( ) ;
295
295
296
296
match ty. kind ( ) {
@@ -329,7 +329,7 @@ pub fn valtree_to_const_value<'tcx>(
329
329
#[ instrument( skip( ecx) , level = "debug" ) ]
330
330
fn valtree_into_mplace < ' tcx > (
331
331
ecx : & mut CompileTimeEvalContext < ' tcx , ' tcx > ,
332
- place : & mut MPlaceTy < ' tcx > ,
332
+ place : & MPlaceTy < ' tcx > ,
333
333
valtree : ty:: ValTree < ' tcx > ,
334
334
) {
335
335
// This will match on valtree and write the value(s) corresponding to the ValTree
@@ -348,11 +348,11 @@ fn valtree_into_mplace<'tcx>(
348
348
ecx. write_immediate ( Immediate :: Scalar ( scalar_int. into ( ) ) , place) . unwrap ( ) ;
349
349
}
350
350
ty:: Ref ( _, inner_ty, _) => {
351
- let mut pointee_place = create_pointee_place ( ecx, * inner_ty, valtree) ;
351
+ let pointee_place = create_pointee_place ( ecx, * inner_ty, valtree) ;
352
352
debug ! ( ?pointee_place) ;
353
353
354
- valtree_into_mplace ( ecx, & mut pointee_place, valtree) ;
355
- dump_place ( ecx, pointee_place. clone ( ) . into ( ) ) ;
354
+ valtree_into_mplace ( ecx, & pointee_place, valtree) ;
355
+ dump_place ( ecx, & pointee_place) ;
356
356
intern_const_alloc_recursive ( ecx, InternKind :: Constant , & pointee_place) . unwrap ( ) ;
357
357
358
358
let imm = match inner_ty. kind ( ) {
@@ -398,7 +398,7 @@ fn valtree_into_mplace<'tcx>(
398
398
for ( i, inner_valtree) in branches. iter ( ) . enumerate ( ) {
399
399
debug ! ( ?i, ?inner_valtree) ;
400
400
401
- let mut place_inner = match ty. kind ( ) {
401
+ let place_inner = match ty. kind ( ) {
402
402
ty:: Str | ty:: Slice ( _) => ecx. project_index ( place, i as u64 ) . unwrap ( ) ,
403
403
_ if !ty. is_sized ( * ecx. tcx , ty:: ParamEnv :: empty ( ) )
404
404
&& i == branches. len ( ) - 1 =>
@@ -443,25 +443,25 @@ fn valtree_into_mplace<'tcx>(
443
443
} ;
444
444
445
445
debug ! ( ?place_inner) ;
446
- valtree_into_mplace ( ecx, & mut place_inner, * inner_valtree) ;
447
- dump_place ( & ecx, place_inner. into ( ) ) ;
446
+ valtree_into_mplace ( ecx, & place_inner, * inner_valtree) ;
447
+ dump_place ( & ecx, & place_inner) ;
448
448
}
449
449
450
450
debug ! ( "dump of place_adjusted:" ) ;
451
- dump_place ( ecx, place_adjusted. into ( ) ) ;
451
+ dump_place ( ecx, & place_adjusted) ;
452
452
453
453
if let Some ( variant_idx) = variant_idx {
454
454
// don't forget filling the place with the discriminant of the enum
455
455
ecx. write_discriminant ( variant_idx, place) . unwrap ( ) ;
456
456
}
457
457
458
458
debug ! ( "dump of place after writing discriminant:" ) ;
459
- dump_place ( ecx, place. clone ( ) . into ( ) ) ;
459
+ dump_place ( ecx, place) ;
460
460
}
461
461
_ => bug ! ( "shouldn't have created a ValTree for {:?}" , ty) ,
462
462
}
463
463
}
464
464
465
- fn dump_place < ' tcx > ( ecx : & CompileTimeEvalContext < ' tcx , ' tcx > , place : PlaceTy < ' tcx > ) {
466
- trace ! ( "{:?}" , ecx. dump_place( * place) ) ;
465
+ fn dump_place < ' tcx > ( ecx : & CompileTimeEvalContext < ' tcx , ' tcx > , place : & MPlaceTy < ' tcx > ) {
466
+ trace ! ( "{:?}" , ecx. dump_place( Place :: Ptr ( * * place) ) ) ;
467
467
}
0 commit comments