about summary refs log tree commit diff
path: root/src/libstd/sys/unix/stack_overflow.rs
diff options
context:
space:
mode:
authorMazdak Farrokhzad <twingoow@gmail.com>2019-03-26 09:05:48 +0100
committerGitHub <noreply@github.com>2019-03-26 09:05:48 +0100
commite298691ee9c7b8eef5b6ec965f2f6bc6d3f22b2d (patch)
treefce2466c1555c97c42037b02c35460b6c8ca3552 /src/libstd/sys/unix/stack_overflow.rs
parent0616b73c2fbe019e3c9273ab10cdf2ef16a78df1 (diff)
parent1ccad16231f58b09f127e679d54162acbc2f0dae (diff)
downloadrust-e298691ee9c7b8eef5b6ec965f2f6bc6d3f22b2d.tar.gz
rust-e298691ee9c7b8eef5b6ec965f2f6bc6d3f22b2d.zip
Rollup merge of #59374 - faern:simplify-checked-duration-since, r=shepmaster
Simplify checked_duration_since

This follows the same design as we updated to in #56490. Internally, all the system specific time implementations are checked, no panics. Then the panicking publicly exported API can just call the checked version of itself and make do with a single panic (`expect`) at the top.

Since the internal sys implementations are now checked, this gets rid of the extra `if self >= &earlier` check in `checked_duration_since`. Except likely making the generated machine code simpler, it also reduces the algorithm from "Check panic condition -> call possibly panicking method" to just "call non panicking method".

Added two test cases:
* Edge case: Make sure `checked_duration_since` on two equal `Instant`s produce a zero duration, not a `None`.
* Most common/intended usage: Make sure `later.checked_duration_since(earlier)`, returns an expected value.
Diffstat (limited to 'src/libstd/sys/unix/stack_overflow.rs')
0 files changed, 0 insertions, 0 deletions