@@ -88,7 +88,7 @@ pub fn value_to_const_value<'tcx>(
88
88
Value :: ScalarPair ( a, b) => Ok ( ConstValue :: ScalarPair ( a, b) ) ,
89
89
Value :: ByRef ( ptr, align) => {
90
90
let ptr = ptr. to_ptr ( ) . unwrap ( ) ;
91
- let alloc = ecx. memory ( ) . get ( ptr. alloc_id ) ?;
91
+ let alloc = ecx. memory . get ( ptr. alloc_id ) ?;
92
92
assert ! ( alloc. align. abi( ) >= align. abi( ) ) ;
93
93
assert ! ( alloc. bytes. len( ) as u64 - ptr. offset. bytes( ) >= layout. size. bytes( ) ) ;
94
94
let mut alloc = alloc. clone ( ) ;
@@ -149,7 +149,7 @@ fn eval_body_using_ecx<'a, 'mir, 'tcx>(
149
149
}
150
150
let layout = ecx. layout_of ( mir. return_ty ( ) . subst ( tcx, cid. instance . substs ) ) ?;
151
151
assert ! ( !layout. is_unsized( ) ) ;
152
- let ptr = ecx. memory_mut ( ) . allocate (
152
+ let ptr = ecx. memory . allocate (
153
153
layout. size ,
154
154
layout. align ,
155
155
MemoryKind :: Stack ,
@@ -185,6 +185,7 @@ fn eval_body_using_ecx<'a, 'mir, 'tcx>(
185
185
Ok ( ( value, ptr, layout. ty ) )
186
186
}
187
187
188
+ #[ derive( Debug , Clone , Eq , PartialEq , Hash ) ]
188
189
pub struct CompileTimeEvaluator ;
189
190
190
191
impl < ' tcx > Into < EvalError < ' tcx > > for ConstEvalError {
@@ -486,7 +487,7 @@ pub fn const_variant_index<'a, 'tcx>(
486
487
let ( ptr, align) = match value {
487
488
Value :: ScalarPair ( ..) | Value :: Scalar ( _) => {
488
489
let layout = ecx. layout_of ( val. ty ) ?;
489
- let ptr = ecx. memory_mut ( ) . allocate ( layout. size , layout. align , MemoryKind :: Stack ) ?. into ( ) ;
490
+ let ptr = ecx. memory . allocate ( layout. size , layout. align , MemoryKind :: Stack ) ?. into ( ) ;
490
491
ecx. write_value_to_ptr ( value, ptr, layout. align , val. ty ) ?;
491
492
( ptr, layout. align )
492
493
} ,
@@ -515,9 +516,9 @@ pub fn const_value_to_allocation_provider<'a, 'tcx>(
515
516
( ) ) ;
516
517
let value = ecx. const_to_value ( val. val ) ?;
517
518
let layout = ecx. layout_of ( val. ty ) ?;
518
- let ptr = ecx. memory_mut ( ) . allocate ( layout. size , layout. align , MemoryKind :: Stack ) ?;
519
+ let ptr = ecx. memory . allocate ( layout. size , layout. align , MemoryKind :: Stack ) ?;
519
520
ecx. write_value_to_ptr ( value, ptr. into ( ) , layout. align , val. ty ) ?;
520
- let alloc = ecx. memory ( ) . get ( ptr. alloc_id ) ?;
521
+ let alloc = ecx. memory . get ( ptr. alloc_id ) ?;
521
522
Ok ( tcx. intern_const_alloc ( alloc. clone ( ) ) )
522
523
} ;
523
524
result ( ) . expect ( "unable to convert ConstValue to Allocation" )
0 commit comments