@@ -231,7 +231,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriInterpCxExt<'mir, 'tcx> {
231
231
}
232
232
233
233
/// Project to the given *named* field (which must be a struct or union type).
234
- fn project_field_named < P : Projectable < ' mir , ' tcx , Provenance > > (
234
+ fn project_field_named < P : Projectable < ' tcx , Provenance > > (
235
235
& self ,
236
236
base : & P ,
237
237
name : & str ,
@@ -252,13 +252,13 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriInterpCxExt<'mir, 'tcx> {
252
252
fn write_int (
253
253
& mut self ,
254
254
i : impl Into < i128 > ,
255
- dest : & PlaceTy < ' tcx , Provenance > ,
255
+ dest : & impl Writeable < ' tcx , Provenance > ,
256
256
) -> InterpResult < ' tcx > {
257
- assert ! ( dest. layout. abi. is_scalar( ) , "write_int on non-scalar type {}" , dest. layout. ty) ;
258
- let val = if dest. layout . abi . is_signed ( ) {
259
- Scalar :: from_int ( i, dest. layout . size )
257
+ assert ! ( dest. layout( ) . abi. is_scalar( ) , "write_int on non-scalar type {}" , dest. layout( ) . ty) ;
258
+ let val = if dest. layout ( ) . abi . is_signed ( ) {
259
+ Scalar :: from_int ( i, dest. layout ( ) . size )
260
260
} else {
261
- Scalar :: from_uint ( u64:: try_from ( i. into ( ) ) . unwrap ( ) , dest. layout . size )
261
+ Scalar :: from_uint ( u64:: try_from ( i. into ( ) ) . unwrap ( ) , dest. layout ( ) . size )
262
262
} ;
263
263
self . eval_context_mut ( ) . write_scalar ( val, dest)
264
264
}
@@ -267,12 +267,12 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriInterpCxExt<'mir, 'tcx> {
267
267
fn write_int_fields (
268
268
& mut self ,
269
269
values : & [ i128 ] ,
270
- dest : & MPlaceTy < ' tcx , Provenance > ,
270
+ dest : & impl Writeable < ' tcx , Provenance > ,
271
271
) -> InterpResult < ' tcx > {
272
272
let this = self . eval_context_mut ( ) ;
273
273
for ( idx, & val) in values. iter ( ) . enumerate ( ) {
274
274
let field = this. project_field ( dest, idx) ?;
275
- this. write_int ( val, & field. into ( ) ) ?;
275
+ this. write_int ( val, & field) ?;
276
276
}
277
277
Ok ( ( ) )
278
278
}
@@ -281,18 +281,18 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriInterpCxExt<'mir, 'tcx> {
281
281
fn write_int_fields_named (
282
282
& mut self ,
283
283
values : & [ ( & str , i128 ) ] ,
284
- dest : & MPlaceTy < ' tcx , Provenance > ,
284
+ dest : & impl Writeable < ' tcx , Provenance > ,
285
285
) -> InterpResult < ' tcx > {
286
286
let this = self . eval_context_mut ( ) ;
287
287
for & ( name, val) in values. iter ( ) {
288
288
let field = this. project_field_named ( dest, name) ?;
289
- this. write_int ( val, & field. into ( ) ) ?;
289
+ this. write_int ( val, & field) ?;
290
290
}
291
291
Ok ( ( ) )
292
292
}
293
293
294
294
/// Write a 0 of the appropriate size to `dest`.
295
- fn write_null ( & mut self , dest : & PlaceTy < ' tcx , Provenance > ) -> InterpResult < ' tcx > {
295
+ fn write_null ( & mut self , dest : & impl Writeable < ' tcx , Provenance > ) -> InterpResult < ' tcx > {
296
296
self . write_int ( 0 , dest)
297
297
}
298
298
@@ -606,7 +606,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriInterpCxExt<'mir, 'tcx> {
606
606
// Allocate new place, set initial value to 0.
607
607
let errno_layout = this. machine . layouts . u32 ;
608
608
let errno_place = this. allocate ( errno_layout, MiriMemoryKind :: Machine . into ( ) ) ?;
609
- this. write_scalar ( Scalar :: from_u32 ( 0 ) , & errno_place. into ( ) ) ?;
609
+ this. write_scalar ( Scalar :: from_u32 ( 0 ) , & errno_place) ?;
610
610
this. active_thread_mut ( ) . last_error = Some ( errno_place) ;
611
611
Ok ( errno_place)
612
612
}
@@ -616,7 +616,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriInterpCxExt<'mir, 'tcx> {
616
616
fn set_last_error ( & mut self , scalar : Scalar < Provenance > ) -> InterpResult < ' tcx > {
617
617
let this = self . eval_context_mut ( ) ;
618
618
let errno_place = this. last_error_place ( ) ?;
619
- this. write_scalar ( scalar, & errno_place. into ( ) )
619
+ this. write_scalar ( scalar, & errno_place)
620
620
}
621
621
622
622
/// Gets the last error variable.
@@ -785,7 +785,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriInterpCxExt<'mir, 'tcx> {
785
785
) -> InterpResult < ' tcx , ( ) > {
786
786
let this = self . eval_context_mut ( ) ;
787
787
let value_place = this. deref_operand_and_offset ( op, offset, base_layout, value_layout) ?;
788
- this. write_scalar ( value, & value_place. into ( ) )
788
+ this. write_scalar ( value, & value_place)
789
789
}
790
790
791
791
/// Parse a `timespec` struct and return it as a `std::time::Duration`. It returns `None`
0 commit comments