Skip to content

Commit

Permalink
Auto merge of #1053 - RalfJung:clean, r=RalfJung
Browse files Browse the repository at this point in the history
remove no-longer-needed zero checks
  • Loading branch information
bors committed Nov 14, 2019
2 parents bf96b47 + c790317 commit 2bdf163
Showing 1 changed file with 2 additions and 8 deletions.
10 changes: 2 additions & 8 deletions src/shims/fs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -175,10 +175,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
.to_machine_usize(&*this.tcx)?
.min((1 << (ptr_size - 1)) - 1) // max value of target `isize`
.min(isize::max_value() as u64);
// Reading zero bytes should not change `buf`.
if count == 0 {
return Ok(0);
}

let fd = this.read_scalar(fd_op)?.to_i32()?;
let buf = this.read_scalar(buf_op)?.not_undef()?;

Expand Down Expand Up @@ -231,10 +228,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
.to_machine_usize(&*this.tcx)?
.min((1 << (ptr_size - 1)) - 1) // max value of target `isize`
.min(isize::max_value() as u64);
// Writing zero bytes should not change `buf`.
if count == 0 {
return Ok(0);
}

let fd = this.read_scalar(fd_op)?.to_i32()?;
let buf = this.read_scalar(buf_op)?.not_undef()?;

Expand Down

0 comments on commit 2bdf163

Please sign in to comment.