@@ -582,8 +582,7 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
582
582
fd. pread ( communicate, & mut bytes, offset, this)
583
583
}
584
584
} ;
585
- let res = read_byte_helper ( buf, bytes, result, this) ?;
586
- this. write_scalar ( res, dest) ?;
585
+ read_byte_helper ( buf, bytes, result, dest, this) ?;
587
586
Ok ( ( ) )
588
587
}
589
588
@@ -625,8 +624,9 @@ fn read_byte_helper<'tcx>(
625
624
buf : Pointer ,
626
625
bytes : Vec < u8 > ,
627
626
result : InterpResult < ' tcx , io:: Result < usize > > ,
627
+ dest : & MPlaceTy < ' tcx > ,
628
628
ecx : & mut MiriInterpCx < ' tcx > ,
629
- ) -> InterpResult < ' tcx , Scalar > {
629
+ ) -> InterpResult < ' tcx > {
630
630
// `File::read` never returns a value larger than `count`, so this cannot fail.
631
631
match result?. map ( |c| i64:: try_from ( c) . unwrap ( ) ) {
632
632
// try to pass this the write_ptr inside write
@@ -639,11 +639,13 @@ fn read_byte_helper<'tcx>(
639
639
buf,
640
640
bytes[ ..usize:: try_from ( read_bytes) . unwrap ( ) ] . iter ( ) . copied ( ) ,
641
641
) ?;
642
- Ok ( Scalar :: from_target_isize ( read_bytes, ecx) )
642
+ ecx. write_scalar ( Scalar :: from_target_isize ( read_bytes, ecx) , dest) ?;
643
+ return Ok ( ( ) ) ;
643
644
}
644
645
Err ( e) => {
645
646
ecx. set_last_error_from_io_error ( e) ?;
646
- Ok ( Scalar :: from_target_isize ( -1 , ecx) )
647
+ ecx. write_scalar ( Scalar :: from_target_isize ( -1 , ecx) , dest) ?;
648
+ return Ok ( ( ) ) ;
647
649
}
648
650
}
649
651
}
0 commit comments