rust/src/libstd/sys/unix
Mazdak Farrokhzad e298691ee9
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.
2019-03-26 09:05:48 +01:00
..
backtrace libstd => 2018 2019-02-28 04:06:15 +09:00
ext Unify OsString/OsStr for byte-based implementations 2019-03-21 13:45:35 -07:00
process libstd => 2018 2019-02-28 04:06:15 +09:00
alloc.rs libstd => 2018 2019-02-28 04:06:15 +09:00
android.rs libstd => 2018 2019-02-28 04:06:15 +09:00
args.rs libstd => 2018 2019-02-28 04:06:15 +09:00
cmath.rs Remove licenses 2018-12-25 21:08:33 -07:00
condvar.rs libstd => 2018 2019-02-28 04:06:15 +09:00
env.rs Remove licenses 2018-12-25 21:08:33 -07:00
fast_thread_local.rs libstd => 2018 2019-02-28 04:06:15 +09:00
fd.rs libstd => 2018 2019-02-28 04:06:15 +09:00
fs.rs Change std::fs::copy to use copyfile on MacOS and iOS 2019-03-04 12:33:15 +00:00
io.rs Fix rebase fail 2019-02-28 04:06:17 +09:00
l4re.rs Add UdpSocket peer_addr implementation for L4Re 2019-03-16 11:20:11 +00:00
memchr.rs libstd => 2018 2019-02-28 04:06:15 +09:00
mod.rs Unify OsString/OsStr for byte-based implementations 2019-03-21 13:45:35 -07:00
mutex.rs libstd => 2018 2019-02-28 04:06:15 +09:00
net.rs Fix rebase fail 2019-02-28 04:06:17 +09:00
os.rs libstd => 2018 2019-02-28 04:06:15 +09:00
path.rs libstd => 2018 2019-02-28 04:06:15 +09:00
pipe.rs libstd => 2018 2019-02-28 04:06:15 +09:00
rand.rs libstd => 2018 2019-02-28 04:06:15 +09:00
rwlock.rs libstd => 2018 2019-02-28 04:06:15 +09:00
stack_overflow.rs FreeBSD 10.x is EOL, in FreeBSD 11 and later, ss_sp is actually a void* [1] 2019-03-21 16:53:31 +01:00
stdio.rs libstd => 2018 2019-02-28 04:06:15 +09:00
thread_local.rs libstd => 2018 2019-02-28 04:06:15 +09:00
thread.rs libstd => 2018 2019-02-28 04:06:15 +09:00
time.rs Update sys::time impls to have checked_sub_instant 2019-03-22 23:56:40 +01:00
weak.rs libstd => 2018 2019-02-28 04:06:15 +09:00