@@ -21,7 +21,7 @@ impl Default for FileHandler {
21
21
fn default ( ) -> Self {
22
22
FileHandler {
23
23
handles : Default :: default ( ) ,
24
- // 0, 1 and 2 are reserved for stdin, stdout and stderr
24
+ // 0, 1 and 2 are reserved for stdin, stdout and stderr.
25
25
low : 3 ,
26
26
}
27
27
}
@@ -123,7 +123,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
123
123
124
124
let fd = this. read_scalar ( fd_op) ?. to_i32 ( ) ?;
125
125
let cmd = this. read_scalar ( cmd_op) ?. to_i32 ( ) ?;
126
- // We only support getting the flags for a descriptor
126
+ // We only support getting the flags for a descriptor.
127
127
if cmd == this. eval_libc_i32 ( "F_GETFD" ) ? {
128
128
// Currently this is the only flag that `F_GETFD` returns. It is OK to just return the
129
129
// `FD_CLOEXEC` value without checking if the flag is set for the file because `std`
@@ -159,16 +159,16 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
159
159
this. check_no_isolation ( "read" ) ?;
160
160
161
161
let count = this. read_scalar ( count_op) ?. to_usize ( & * this. tcx ) ?;
162
- // Reading zero bytes should not change `buf`
162
+ // Reading zero bytes should not change `buf`.
163
163
if count == 0 {
164
164
return Ok ( 0 ) ;
165
165
}
166
166
let fd = this. read_scalar ( fd_op) ?. to_i32 ( ) ?;
167
167
let buf_scalar = this. read_scalar ( buf_op) ?. not_undef ( ) ?;
168
168
169
- // Remove the file handle to avoid borrowing issues
169
+ // Remove the file handle to avoid borrowing issues.
170
170
this. remove_handle_and ( fd, |mut handle, this| {
171
- // Don't use `?` to avoid returning before reinserting the handle
171
+ // Don't use `?` to avoid returning before reinserting the handle.
172
172
let bytes = this. force_ptr ( buf_scalar) . and_then ( |buf| {
173
173
this. memory
174
174
. get_mut ( buf. alloc_id ) ?
@@ -191,7 +191,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
191
191
this. check_no_isolation ( "write" ) ?;
192
192
193
193
let count = this. read_scalar ( count_op) ?. to_usize ( & * this. tcx ) ?;
194
- // Writing zero bytes should not change `buf`
194
+ // Writing zero bytes should not change `buf`.
195
195
if count == 0 {
196
196
return Ok ( 0 ) ;
197
197
}
@@ -232,7 +232,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
232
232
/// and sets `Evaluator::last_error` to `libc::EBADF` (invalid file descriptor).
233
233
///
234
234
/// This function uses `T: From<i32>` instead of `i32` directly because some IO related
235
- /// functions return different integer types (like `read`, that returns an `i64`)
235
+ /// functions return different integer types (like `read`, that returns an `i64`).
236
236
fn get_handle_and < F , T : From < i32 > > ( & mut self , fd : i32 , f : F ) -> InterpResult < ' tcx , T >
237
237
where
238
238
F : Fn ( & FileHandle ) -> InterpResult < ' tcx , T > ,
@@ -256,7 +256,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
256
256
/// and sets `Evaluator::last_error` to `libc::EBADF` (invalid file descriptor).
257
257
///
258
258
/// This function uses `T: From<i32>` instead of `i32` directly because some IO related
259
- /// functions return different integer types (like `read`, that returns an `i64`)
259
+ /// functions return different integer types (like `read`, that returns an `i64`).
260
260
fn remove_handle_and < F , T : From < i32 > > ( & mut self , fd : i32 , mut f : F ) -> InterpResult < ' tcx , T >
261
261
where
262
262
F : FnMut ( FileHandle , & mut MiriEvalContext < ' mir , ' tcx > ) -> InterpResult < ' tcx , T > ,
0 commit comments