@@ -305,19 +305,6 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriInterpCxExt<'mir, 'tcx> {
305
305
306
306
impl < ' mir , ' tcx : ' mir > EvalContextExtPriv < ' mir , ' tcx > for crate :: MiriInterpCx < ' mir , ' tcx > { }
307
307
trait EvalContextExtPriv < ' mir , ' tcx : ' mir > : crate :: MiriInterpCxExt < ' mir , ' tcx > {
308
- /// Read bytes from a `(ptr, len)` argument
309
- fn read_byte_slice < ' i > ( & ' i self , bytes : & OpTy < ' tcx , Provenance > ) -> InterpResult < ' tcx , & ' i [ u8 ] >
310
- where
311
- ' mir : ' i ,
312
- {
313
- let this = self . eval_context_ref ( ) ;
314
- let ( ptr, len) = this. read_immediate ( bytes) ?. to_scalar_pair ( ) ;
315
- let ptr = ptr. to_pointer ( this) ?;
316
- let len = len. to_target_usize ( this) ?;
317
- let bytes = this. read_bytes_ptr_strip_provenance ( ptr, Size :: from_bytes ( len) ) ?;
318
- Ok ( bytes)
319
- }
320
-
321
308
/// Returns the minimum alignment for the target architecture for allocations of the given size.
322
309
fn min_align ( & self , size : u64 , kind : MiriMemoryKind ) -> Align {
323
310
let this = self . eval_context_ref ( ) ;
@@ -466,7 +453,9 @@ trait EvalContextExtPriv<'mir, 'tcx: 'mir>: crate::MiriInterpCxExt<'mir, 'tcx> {
466
453
let [ ptr, nth_parent, name] = this. check_shim ( abi, Abi :: Rust , link_name, args) ?;
467
454
let ptr = this. read_pointer ( ptr) ?;
468
455
let nth_parent = this. read_scalar ( nth_parent) ?. to_u8 ( ) ?;
469
- let name = this. read_byte_slice ( name) ?;
456
+ let name = this. read_immediate ( name) ?;
457
+
458
+ let name = this. read_byte_slice ( & name) ?;
470
459
// We must make `name` owned because we need to
471
460
// end the shared borrow from `read_byte_slice` before we can
472
461
// start the mutable borrow for `give_pointer_debug_name`.
@@ -527,7 +516,8 @@ trait EvalContextExtPriv<'mir, 'tcx: 'mir>: crate::MiriInterpCxExt<'mir, 'tcx> {
527
516
// README for details.
528
517
"miri_write_to_stdout" | "miri_write_to_stderr" => {
529
518
let [ msg] = this. check_shim ( abi, Abi :: Rust , link_name, args) ?;
530
- let msg = this. read_byte_slice ( msg) ?;
519
+ let msg = this. read_immediate ( msg) ?;
520
+ let msg = this. read_byte_slice ( & msg) ?;
531
521
// Note: we're ignoring errors writing to host stdout/stderr.
532
522
let _ignore = match link_name. as_str ( ) {
533
523
"miri_write_to_stdout" => std:: io:: stdout ( ) . write_all ( msg) ,
0 commit comments