@@ -305,19 +305,6 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriInterpCxExt<'mir, 'tcx> {
305305
306306impl < ' mir , ' tcx : ' mir > EvalContextExtPriv < ' mir , ' tcx > for crate :: MiriInterpCx < ' mir , ' tcx > { }
307307trait 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-
321308 /// Returns the minimum alignment for the target architecture for allocations of the given size.
322309 fn min_align ( & self , size : u64 , kind : MiriMemoryKind ) -> Align {
323310 let this = self . eval_context_ref ( ) ;
@@ -466,7 +453,9 @@ trait EvalContextExtPriv<'mir, 'tcx: 'mir>: crate::MiriInterpCxExt<'mir, 'tcx> {
466453 let [ ptr, nth_parent, name] = this. check_shim ( abi, Abi :: Rust , link_name, args) ?;
467454 let ptr = this. read_pointer ( ptr) ?;
468455 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) ?;
470459 // We must make `name` owned because we need to
471460 // end the shared borrow from `read_byte_slice` before we can
472461 // start the mutable borrow for `give_pointer_debug_name`.
@@ -527,7 +516,8 @@ trait EvalContextExtPriv<'mir, 'tcx: 'mir>: crate::MiriInterpCxExt<'mir, 'tcx> {
527516 // README for details.
528517 "miri_write_to_stdout" | "miri_write_to_stderr" => {
529518 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) ?;
531521 // Note: we're ignoring errors writing to host stdout/stderr.
532522 let _ignore = match link_name. as_str ( ) {
533523 "miri_write_to_stdout" => std:: io:: stdout ( ) . write_all ( msg) ,
0 commit comments