@@ -15,6 +15,8 @@ use super::{
1515 MemoryExt ,
1616} ;
1717
18+ use super :: memory:: Kind ;
19+
1820pub trait EvalContextExt < ' tcx > {
1921 fn call_c_abi (
2022 & mut self ,
@@ -110,15 +112,15 @@ impl<'a, 'tcx> EvalContextExt<'tcx> for EvalContext<'a, 'tcx, super::Evaluator>
110112 self . write_null ( dest, dest_ty) ?;
111113 } else {
112114 let align = self . memory . pointer_size ( ) ;
113- let ptr = self . memory . allocate ( size, align, Kind :: C ) ?;
115+ let ptr = self . memory . allocate ( size, align, Kind :: C . into ( ) ) ?;
114116 self . write_primval ( dest, PrimVal :: Ptr ( ptr) , dest_ty) ?;
115117 }
116118 }
117119
118120 "free" => {
119121 let ptr = args[ 0 ] . into_ptr ( & mut self . memory ) ?;
120122 if !ptr. is_null ( ) ? {
121- self . memory . deallocate ( ptr. to_ptr ( ) ?, None , Kind :: C ) ?;
123+ self . memory . deallocate ( ptr. to_ptr ( ) ?, None , Kind :: C . into ( ) ) ?;
122124 }
123125 }
124126
@@ -242,7 +244,7 @@ impl<'a, 'tcx> EvalContextExt<'tcx> for EvalContext<'a, 'tcx, super::Evaluator>
242244 }
243245 if let Some ( old) = success {
244246 if let Some ( var) = old {
245- self . memory . deallocate ( var, None , Kind :: Env ) ?;
247+ self . memory . deallocate ( var, None , Kind :: Env . into ( ) ) ?;
246248 }
247249 self . write_null ( dest, dest_ty) ?;
248250 } else {
@@ -265,12 +267,12 @@ impl<'a, 'tcx> EvalContextExt<'tcx> for EvalContext<'a, 'tcx, super::Evaluator>
265267 }
266268 if let Some ( ( name, value) ) = new {
267269 // +1 for the null terminator
268- let value_copy = self . memory . allocate ( ( value. len ( ) + 1 ) as u64 , 1 , Kind :: Env ) ?;
270+ let value_copy = self . memory . allocate ( ( value. len ( ) + 1 ) as u64 , 1 , Kind :: Env . into ( ) ) ?;
269271 self . memory . write_bytes ( value_copy. into ( ) , & value) ?;
270272 let trailing_zero_ptr = value_copy. offset ( value. len ( ) as u64 , & self ) ?. into ( ) ;
271273 self . memory . write_bytes ( trailing_zero_ptr, & [ 0 ] ) ?;
272274 if let Some ( var) = self . machine_data . env_vars . insert ( name. to_owned ( ) , value_copy) {
273- self . memory . deallocate ( var, None , Kind :: Env ) ?;
275+ self . memory . deallocate ( var, None , Kind :: Env . into ( ) ) ?;
274276 }
275277 self . write_null ( dest, dest_ty) ?;
276278 } else {
@@ -491,7 +493,7 @@ impl<'a, 'tcx> EvalContextExt<'tcx> for EvalContext<'a, 'tcx, super::Evaluator>
491493 if !align. is_power_of_two ( ) {
492494 return Err ( EvalError :: HeapAllocNonPowerOfTwoAlignment ( align) ) ;
493495 }
494- let ptr = self . memory . allocate ( size, align, Kind :: Rust ) ?;
496+ let ptr = self . memory . allocate ( size, align, Kind :: Rust . into ( ) ) ?;
495497 self . write_primval ( dest, PrimVal :: Ptr ( ptr) , dest_ty) ?;
496498 }
497499 "alloc::heap::::__rust_alloc_zeroed" => {
@@ -503,7 +505,7 @@ impl<'a, 'tcx> EvalContextExt<'tcx> for EvalContext<'a, 'tcx, super::Evaluator>
503505 if !align. is_power_of_two ( ) {
504506 return Err ( EvalError :: HeapAllocNonPowerOfTwoAlignment ( align) ) ;
505507 }
506- let ptr = self . memory . allocate ( size, align, Kind :: Rust ) ?;
508+ let ptr = self . memory . allocate ( size, align, Kind :: Rust . into ( ) ) ?;
507509 self . memory . write_repeat ( ptr. into ( ) , 0 , size) ?;
508510 self . write_primval ( dest, PrimVal :: Ptr ( ptr) , dest_ty) ?;
509511 }
@@ -517,7 +519,7 @@ impl<'a, 'tcx> EvalContextExt<'tcx> for EvalContext<'a, 'tcx, super::Evaluator>
517519 if !align. is_power_of_two ( ) {
518520 return Err ( EvalError :: HeapAllocNonPowerOfTwoAlignment ( align) ) ;
519521 }
520- self . memory . deallocate ( ptr, Some ( ( old_size, align) ) , Kind :: Rust ) ?;
522+ self . memory . deallocate ( ptr, Some ( ( old_size, align) ) , Kind :: Rust . into ( ) ) ?;
521523 }
522524 "alloc::heap::::__rust_realloc" => {
523525 let ptr = args[ 0 ] . into_ptr ( & mut self . memory ) ?. to_ptr ( ) ?;
@@ -534,7 +536,7 @@ impl<'a, 'tcx> EvalContextExt<'tcx> for EvalContext<'a, 'tcx, super::Evaluator>
534536 if !new_align. is_power_of_two ( ) {
535537 return Err ( EvalError :: HeapAllocNonPowerOfTwoAlignment ( new_align) ) ;
536538 }
537- let new_ptr = self . memory . reallocate ( ptr, old_size, old_align, new_size, new_align, Kind :: Rust ) ?;
539+ let new_ptr = self . memory . reallocate ( ptr, old_size, old_align, new_size, new_align, Kind :: Rust . into ( ) ) ?;
538540 self . write_primval ( dest, PrimVal :: Ptr ( new_ptr) , dest_ty) ?;
539541 }
540542
0 commit comments