@@ -108,7 +108,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
108108 fh. low
109109 } ) ;
110110
111- this. set_last_error_from_io_result ( fd)
111+ this. try_unwrap_io_result ( fd)
112112 }
113113
114114 fn fcntl (
@@ -144,7 +144,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
144144 let fd = this. read_scalar ( fd_op) ?. to_i32 ( ) ?;
145145
146146 this. remove_handle_and ( fd, |handle, this| {
147- this. set_last_error_from_io_result ( handle. file . sync_all ( ) . map ( |_| 0i32 ) )
147+ this. try_unwrap_io_result ( handle. file . sync_all ( ) . map ( |_| 0i32 ) )
148148 } )
149149 }
150150
@@ -175,9 +175,8 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
175175 . get_bytes_mut ( & * this. tcx , buf, Size :: from_bytes ( count) )
176176 . map ( |buffer| handle. file . read ( buffer) )
177177 } ) ;
178- // Reinsert the file handle
179178 this. machine . file_handler . handles . insert ( fd, handle) . unwrap_none ( ) ;
180- this. set_last_error_from_io_result ( bytes?. map ( |bytes| bytes as i64 ) )
179+ this. try_unwrap_io_result ( bytes?. map ( |bytes| bytes as i64 ) )
181180 } )
182181 }
183182
@@ -206,7 +205,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
206205 . map ( |bytes| handle. file . write ( bytes) . map ( |bytes| bytes as i64 ) )
207206 } ) ;
208207 this. machine . file_handler . handles . insert ( fd, handle) . unwrap_none ( ) ;
209- this. set_last_error_from_io_result ( bytes?)
208+ this. try_unwrap_io_result ( bytes?)
210209 } )
211210 }
212211
@@ -223,7 +222,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
223222
224223 let result = remove_file ( path) . map ( |_| 0 ) ;
225224
226- this. set_last_error_from_io_result ( result)
225+ this. try_unwrap_io_result ( result)
227226 }
228227
229228 /// Helper function that gets a `FileHandle` immutable reference and allows to manipulate it
0 commit comments