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