@@ -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 ( )
@@ -688,6 +688,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
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 ) ;
690690
691+ let communicate = this. machine . communicate ( ) ;
691692 if let Some ( file_descriptor) = this. machine . file_handler . handles . get_mut ( & fd) {
692693 trace ! ( "read: FD mapped to {:?}" , file_descriptor) ;
693694 // We want to read at most `count` bytes. We are sure that `count` is not negative
@@ -697,7 +698,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
697698 // `File::read` never returns a value larger than `count`,
698699 // so this cannot fail.
699700 let result = file_descriptor
700- . read ( this . machine . communicate , & mut bytes) ?
701+ . read ( communicate, & mut bytes) ?
701702 . map ( |c| i64:: try_from ( c) . unwrap ( ) ) ;
702703
703704 match result {
@@ -734,10 +735,11 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
734735 // host's and target's `isize`. This saves us from having to handle overflows later.
735736 let count = count. min ( this. machine_isize_max ( ) as u64 ) . min ( isize:: MAX as u64 ) ;
736737
738+ let communicate = this. machine . communicate ( ) ;
737739 if let Some ( file_descriptor) = this. machine . file_handler . handles . get_mut ( & fd) {
738740 let bytes = this. memory . read_bytes ( buf, Size :: from_bytes ( count) ) ?;
739741 let result = file_descriptor
740- . write ( this . machine . communicate , & bytes) ?
742+ . write ( communicate, & bytes) ?
741743 . map ( |c| i64:: try_from ( c) . unwrap ( ) ) ;
742744 this. try_unwrap_io_result ( result)
743745 } else {
@@ -771,9 +773,10 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
771773 return Ok ( -1 ) ;
772774 } ;
773775
776+ let communicate = this. machine . communicate ( ) ;
774777 if let Some ( file_descriptor) = this. machine . file_handler . handles . get_mut ( & fd) {
775778 let result = file_descriptor
776- . seek ( this . machine . communicate , seek_from) ?
779+ . seek ( communicate, seek_from) ?
777780 . map ( |offset| i64:: try_from ( offset) . unwrap ( ) ) ;
778781 this. try_unwrap_io_result ( result)
779782 } else {
0 commit comments