@@ -662,7 +662,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
662662 let fd = this. read_scalar ( fd_op) ?. to_i32 ( ) ?;
663663
664664 if let Some ( file_descriptor) = this. machine . file_handler . handles . remove ( & fd) {
665- let result = file_descriptor. close ( this. machine . communicate ) ?;
665+ let result = file_descriptor. close ( this. machine . communicate ( ) ) ?;
666666 this. try_unwrap_io_result ( result)
667667 } else {
668668 this. handle_not_found ( )
@@ -687,6 +687,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
687687 // We cap the number of read bytes to the largest value that we are able to fit in both the
688688 // host's and target's `isize`. This saves us from having to handle overflows later.
689689 let count = count. min ( this. machine_isize_max ( ) as u64 ) . min ( isize:: MAX as u64 ) ;
690+ let communicate = this. machine . communicate ( ) ;
690691
691692 if let Some ( file_descriptor) = this. machine . file_handler . handles . get_mut ( & fd) {
692693 trace ! ( "read: FD mapped to {:?}" , file_descriptor) ;
@@ -696,9 +697,8 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
696697 let mut bytes = vec ! [ 0 ; count as usize ] ;
697698 // `File::read` never returns a value larger than `count`,
698699 // so this cannot fail.
699- let result = file_descriptor
700- . read ( this. machine . communicate , & mut bytes) ?
701- . map ( |c| i64:: try_from ( c) . unwrap ( ) ) ;
700+ let result =
701+ file_descriptor. read ( communicate, & mut bytes) ?. map ( |c| i64:: try_from ( c) . unwrap ( ) ) ;
702702
703703 match result {
704704 Ok ( read_bytes) => {
@@ -733,12 +733,12 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
733733 // We cap the number of written bytes to the largest value that we are able to fit in both the
734734 // host's and target's `isize`. This saves us from having to handle overflows later.
735735 let count = count. min ( this. machine_isize_max ( ) as u64 ) . min ( isize:: MAX as u64 ) ;
736+ let communicate = this. machine . communicate ( ) ;
736737
737738 if let Some ( file_descriptor) = this. machine . file_handler . handles . get_mut ( & fd) {
738739 let bytes = this. memory . read_bytes ( buf, Size :: from_bytes ( count) ) ?;
739- let result = file_descriptor
740- . write ( this. machine . communicate , & bytes) ?
741- . map ( |c| i64:: try_from ( c) . unwrap ( ) ) ;
740+ let result =
741+ file_descriptor. write ( communicate, & bytes) ?. map ( |c| i64:: try_from ( c) . unwrap ( ) ) ;
742742 this. try_unwrap_io_result ( result)
743743 } else {
744744 this. handle_not_found ( )
@@ -771,9 +771,10 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
771771 return Ok ( -1 ) ;
772772 } ;
773773
774+ let communicate = this. machine . communicate ( ) ;
774775 if let Some ( file_descriptor) = this. machine . file_handler . handles . get_mut ( & fd) {
775776 let result = file_descriptor
776- . seek ( this . machine . communicate , seek_from) ?
777+ . seek ( communicate, seek_from) ?
777778 . map ( |offset| i64:: try_from ( offset) . unwrap ( ) ) ;
778779 this. try_unwrap_io_result ( result)
779780 } else {
0 commit comments