Skip to content

Commit d0b4407

Browse files
committed
Fix casts for count check
1 parent 06ef77b commit d0b4407

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/shims/fs.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
146146
// `File::sync_all` does the checks that are done when closing a file. We do this to
147147
// to handle possible errors correctly.
148148
let result = this.try_unwrap_io_result(handle.file.sync_all().map(|_| 0i32));
149-
// Now we actually drop the handle.
149+
// Now we actually close the file.
150150
drop(handle);
151151
// And return the result.
152152
result
@@ -180,7 +180,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
180180

181181
if let Ok(c) = result {
182182
// Check that we read less than `i64::MAX` bytes.
183-
if c > (i64::max_value() as usize) {
183+
if (c as u64) > (i64::max_value() as u64) {
184184
throw_unsup_format!("Number of read bytes {} is larger than the maximum value", c);
185185
}
186186
// If reading to `bytes` did not fail, we write those bytes to the buffer.
@@ -217,7 +217,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
217217

218218
if let Ok(c) = result {
219219
// Check that we wrote less than `i64::MAX` bytes.
220-
if c > (i64::max_value() as usize) {
220+
if (c as u64) > (i64::max_value() as u64) {
221221
throw_unsup_format!("Number of written bytes {} is larger than the maximum value", c);
222222
}
223223
}

0 commit comments

Comments
 (0)