Checked add for duration update
Co-authored-by: Ralf Jung <post@ralfj.de>
This commit is contained in:
parent
d0fb350b6a
commit
e85c521f37
1 changed files with 1 additions and 1 deletions
|
@ -102,7 +102,7 @@ impl Clock {
|
|||
ClockKind::Virtual { nanoseconds } => {
|
||||
// Just pretend that we have slept for some time.
|
||||
let nanos: u128 = duration.as_nanos();
|
||||
nanoseconds.update(|x| x + nanos);
|
||||
nanoseconds.update(|x| x.checked_add(nanos).expect("Miri's virtual clock cannot represent an execution this long"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue