@@ -621,7 +621,7 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
621
621
this. write_scalar ( Scalar :: from_target_isize ( res, this) , dest) ?;
622
622
return Ok ( ( ) ) ;
623
623
} ;
624
- write_byte_helper ( offset, fd, bytes, communicate, dest, this ) ?;
624
+ self . write_byte_helper ( offset, fd, bytes, communicate, dest) ?;
625
625
Ok ( ( ) )
626
626
}
627
627
@@ -657,32 +657,34 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
657
657
}
658
658
}
659
659
}
660
- }
661
660
662
- fn write_byte_helper < ' tcx > (
663
- offset : Option < i128 > ,
664
- fd : FileDescriptionRef ,
665
- bytes : Vec < u8 > ,
666
- communicate : bool ,
667
- dest : & MPlaceTy < ' tcx > ,
668
- ecx : & mut MiriInterpCx < ' tcx > ,
669
- ) -> InterpResult < ' tcx > {
670
- let result = match offset {
671
- None => fd. write ( & fd, communicate, & bytes, ecx) ,
672
- Some ( offset) => {
673
- let Ok ( offset) = u64:: try_from ( offset) else {
674
- let einval = ecx. eval_libc ( "EINVAL" ) ;
675
- ecx. set_last_error ( einval) ?;
676
- let res = Scalar :: from_target_isize ( -1 , ecx) ;
677
- ecx. write_scalar ( res, dest) ?;
678
- return Ok ( ( ) ) ;
679
- } ;
680
- fd. pwrite ( communicate, & bytes, offset, ecx)
681
- }
682
- } ;
683
- // Write the result to the dest place.
684
- let result = result?. map ( |c| i64:: try_from ( c) . unwrap ( ) ) ;
685
- let res = Scalar :: from_target_isize ( ecx. try_unwrap_io_result ( result) ?, ecx) ;
686
- ecx. write_scalar ( res, dest) ?;
687
- return Ok ( ( ) ) ;
661
+ fn write_byte_helper (
662
+ & mut self ,
663
+ offset : Option < i128 > ,
664
+ fd : FileDescriptionRef ,
665
+ bytes : Vec < u8 > ,
666
+ communicate : bool ,
667
+ dest : & MPlaceTy < ' tcx > ,
668
+ ) -> InterpResult < ' tcx > {
669
+ let this = self . eval_context_mut ( ) ;
670
+
671
+ let result = match offset {
672
+ None => fd. write ( & fd, communicate, & bytes, this) ,
673
+ Some ( offset) => {
674
+ let Ok ( offset) = u64:: try_from ( offset) else {
675
+ let einval = this. eval_libc ( "EINVAL" ) ;
676
+ this. set_last_error ( einval) ?;
677
+ let res = Scalar :: from_target_isize ( -1 , this) ;
678
+ this. write_scalar ( res, dest) ?;
679
+ return Ok ( ( ) ) ;
680
+ } ;
681
+ fd. pwrite ( communicate, & bytes, offset, this)
682
+ }
683
+ } ;
684
+ // Write the result to the dest place.
685
+ let result = result?. map ( |c| i64:: try_from ( c) . unwrap ( ) ) ;
686
+ let res = Scalar :: from_target_isize ( this. try_unwrap_io_result ( result) ?, this) ;
687
+ this. write_scalar ( res, dest) ?;
688
+ return Ok ( ( ) ) ;
689
+ }
688
690
}
0 commit comments