@@ -108,7 +108,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
108
108
fh. low
109
109
} ) ;
110
110
111
- this. set_last_error_from_io_result ( fd)
111
+ this. try_unwrap_io_result ( fd)
112
112
}
113
113
114
114
fn fcntl (
@@ -144,7 +144,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
144
144
let fd = this. read_scalar ( fd_op) ?. to_i32 ( ) ?;
145
145
146
146
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 ) )
148
148
} )
149
149
}
150
150
@@ -175,9 +175,8 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
175
175
. get_bytes_mut ( & * this. tcx , buf, Size :: from_bytes ( count) )
176
176
. map ( |buffer| handle. file . read ( buffer) )
177
177
} ) ;
178
- // Reinsert the file handle
179
178
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 ) )
181
180
} )
182
181
}
183
182
@@ -206,7 +205,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
206
205
. map ( |bytes| handle. file . write ( bytes) . map ( |bytes| bytes as i64 ) )
207
206
} ) ;
208
207
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?)
210
209
} )
211
210
}
212
211
@@ -223,7 +222,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
223
222
224
223
let result = remove_file ( path) . map ( |_| 0 ) ;
225
224
226
- this. set_last_error_from_io_result ( result)
225
+ this. try_unwrap_io_result ( result)
227
226
}
228
227
229
228
/// Helper function that gets a `FileHandle` immutable reference and allows to manipulate it
0 commit comments