@@ -483,13 +483,13 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
483
483
484
484
let communicate = this. machine . communicate ( ) ;
485
485
486
- let Some ( mut file_descriptor ) = this. machine . fds . get_mut ( fd) else {
486
+ let Some ( mut file_description ) = this. machine . fds . get_mut ( fd) else {
487
487
return Ok ( Scalar :: from_i64 ( this. fd_not_found ( ) ?) ) ;
488
488
} ;
489
- let result = file_descriptor
489
+ let result = file_description
490
490
. seek ( communicate, seek_from) ?
491
491
. map ( |offset| i64:: try_from ( offset) . unwrap ( ) ) ;
492
- drop ( file_descriptor ) ;
492
+ drop ( file_description ) ;
493
493
494
494
let result = this. try_unwrap_io_result ( result) ?;
495
495
Ok ( Scalar :: from_i64 ( result) )
@@ -1176,30 +1176,30 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
1176
1176
return Ok ( Scalar :: from_i32 ( this. fd_not_found ( ) ?) ) ;
1177
1177
}
1178
1178
1179
- let Some ( file_descriptor ) = this. machine . fds . get ( fd) else {
1179
+ let Some ( file_description ) = this. machine . fds . get ( fd) else {
1180
1180
return Ok ( Scalar :: from_i32 ( this. fd_not_found ( ) ?) ) ;
1181
1181
} ;
1182
1182
1183
1183
// FIXME: Support ftruncate64 for all FDs
1184
1184
let FileHandle { file, writable } =
1185
- file_descriptor . downcast_ref :: < FileHandle > ( ) . ok_or_else ( || {
1185
+ file_description . downcast_ref :: < FileHandle > ( ) . ok_or_else ( || {
1186
1186
err_unsup_format ! ( "`ftruncate64` is only supported on file-backed file descriptors" )
1187
1187
} ) ?;
1188
1188
1189
1189
if * writable {
1190
1190
if let Ok ( length) = length. try_into ( ) {
1191
1191
let result = file. set_len ( length) ;
1192
- drop ( file_descriptor ) ;
1192
+ drop ( file_description ) ;
1193
1193
let result = this. try_unwrap_io_result ( result. map ( |_| 0i32 ) ) ?;
1194
1194
Ok ( Scalar :: from_i32 ( result) )
1195
1195
} else {
1196
- drop ( file_descriptor ) ;
1196
+ drop ( file_description ) ;
1197
1197
let einval = this. eval_libc ( "EINVAL" ) ;
1198
1198
this. set_last_error ( einval) ?;
1199
1199
Ok ( Scalar :: from_i32 ( -1 ) )
1200
1200
}
1201
1201
} else {
1202
- drop ( file_descriptor ) ;
1202
+ drop ( file_description ) ;
1203
1203
// The file is not writable
1204
1204
let einval = this. eval_libc ( "EINVAL" ) ;
1205
1205
this. set_last_error ( einval) ?;
@@ -1229,16 +1229,16 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
1229
1229
1230
1230
fn ffullsync_fd ( & mut self , fd : i32 ) -> InterpResult < ' tcx , i32 > {
1231
1231
let this = self . eval_context_mut ( ) ;
1232
- let Some ( file_descriptor ) = this. machine . fds . get ( fd) else {
1232
+ let Some ( file_description ) = this. machine . fds . get ( fd) else {
1233
1233
return Ok ( this. fd_not_found ( ) ?) ;
1234
1234
} ;
1235
1235
// Only regular files support synchronization.
1236
1236
let FileHandle { file, writable } =
1237
- file_descriptor . downcast_ref :: < FileHandle > ( ) . ok_or_else ( || {
1237
+ file_description . downcast_ref :: < FileHandle > ( ) . ok_or_else ( || {
1238
1238
err_unsup_format ! ( "`fsync` is only supported on file-backed file descriptors" )
1239
1239
} ) ?;
1240
1240
let io_result = maybe_sync_file ( file, * writable, File :: sync_all) ;
1241
- drop ( file_descriptor ) ;
1241
+ drop ( file_description ) ;
1242
1242
this. try_unwrap_io_result ( io_result)
1243
1243
}
1244
1244
@@ -1254,16 +1254,16 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
1254
1254
return this. fd_not_found ( ) ;
1255
1255
}
1256
1256
1257
- let Some ( file_descriptor ) = this. machine . fds . get ( fd) else {
1257
+ let Some ( file_description ) = this. machine . fds . get ( fd) else {
1258
1258
return Ok ( this. fd_not_found ( ) ?) ;
1259
1259
} ;
1260
1260
// Only regular files support synchronization.
1261
1261
let FileHandle { file, writable } =
1262
- file_descriptor . downcast_ref :: < FileHandle > ( ) . ok_or_else ( || {
1262
+ file_description . downcast_ref :: < FileHandle > ( ) . ok_or_else ( || {
1263
1263
err_unsup_format ! ( "`fdatasync` is only supported on file-backed file descriptors" )
1264
1264
} ) ?;
1265
1265
let io_result = maybe_sync_file ( file, * writable, File :: sync_data) ;
1266
- drop ( file_descriptor ) ;
1266
+ drop ( file_description ) ;
1267
1267
this. try_unwrap_io_result ( io_result)
1268
1268
}
1269
1269
@@ -1302,18 +1302,18 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
1302
1302
return Ok ( Scalar :: from_i32 ( this. fd_not_found ( ) ?) ) ;
1303
1303
}
1304
1304
1305
- let Some ( file_descriptor ) = this. machine . fds . get ( fd) else {
1305
+ let Some ( file_description ) = this. machine . fds . get ( fd) else {
1306
1306
return Ok ( Scalar :: from_i32 ( this. fd_not_found ( ) ?) ) ;
1307
1307
} ;
1308
1308
// Only regular files support synchronization.
1309
1309
let FileHandle { file, writable } =
1310
- file_descriptor . downcast_ref :: < FileHandle > ( ) . ok_or_else ( || {
1310
+ file_description . downcast_ref :: < FileHandle > ( ) . ok_or_else ( || {
1311
1311
err_unsup_format ! (
1312
1312
"`sync_data_range` is only supported on file-backed file descriptors"
1313
1313
)
1314
1314
} ) ?;
1315
1315
let io_result = maybe_sync_file ( file, * writable, File :: sync_data) ;
1316
- drop ( file_descriptor ) ;
1316
+ drop ( file_description ) ;
1317
1317
Ok ( Scalar :: from_i32 ( this. try_unwrap_io_result ( io_result) ?) )
1318
1318
}
1319
1319
@@ -1609,11 +1609,11 @@ impl FileMetadata {
1609
1609
ecx : & mut MiriInterpCx < ' tcx > ,
1610
1610
fd : i32 ,
1611
1611
) -> InterpResult < ' tcx , Option < FileMetadata > > {
1612
- let Some ( file_descriptor ) = ecx. machine . fds . get ( fd) else {
1612
+ let Some ( file_description ) = ecx. machine . fds . get ( fd) else {
1613
1613
return ecx. fd_not_found ( ) . map ( |_: i32 | None ) ;
1614
1614
} ;
1615
1615
1616
- let file = & file_descriptor
1616
+ let file = & file_description
1617
1617
. downcast_ref :: < FileHandle > ( )
1618
1618
. ok_or_else ( || {
1619
1619
err_unsup_format ! (
@@ -1623,7 +1623,7 @@ impl FileMetadata {
1623
1623
. file ;
1624
1624
1625
1625
let metadata = file. metadata ( ) ;
1626
- drop ( file_descriptor ) ;
1626
+ drop ( file_description ) ;
1627
1627
FileMetadata :: from_meta ( ecx, metadata)
1628
1628
}
1629
1629
0 commit comments