Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

make Instant::{duration_since, elapsed, sub} saturating and remove workarounds #89926

Merged
merged 4 commits into from
Feb 13, 2022

Conversation

the8472
Copy link
Member

@the8472 the8472 commented Oct 15, 2021

This removes all mutex/atomic-based workarounds for non-monotonic clocks and makes the previously panicking methods saturating instead. Additionally saturating_duration_since becomes deprecated since duration_since now fills that role.

Effectively this moves the fixup from Instant construction to the comparisons.

This has some observable effects, especially on platforms without monotonic clocks:

  • Incorrectly ordered Instant comparisons no longer panic in release mode. This could hide some programming errors, but since debug mode still panics tests can still catch them.
  • checked_duration_since will now return None in more cases. Previously it only happened when one compared instants obtained in the wrong order or manually created ones. Now it also does on backslides.
  • non-monotonic intervals will not be transitive, i.e. b.duration_since(a) + c.duration_since(b) != c.duration_since(a)

The upsides are reduced complexity and lower overhead of Instant::now.

Motivation

Currently we must choose between two poisons. One is high worst-case latency and jitter of Instant::now() due to explicit synchronization; see #83093 for benchmarks, the worst-case overhead is > 100x. The other is sporadic panics on specific, rare combinations of CPU/hypervisor/operating system due to platform bugs.

Use-cases where low-overhead, fine-grained timestamps are needed - such as syscall tracing, performance profiles or sensor data acquisition (drone flight controllers were mentioned in a libs meeting) in multi-threaded programs - are negatively impacted by the synchronization.

The panics are user-visible (program crashes), hard to reproduce and can be triggered by any dependency that might be using Instants for any reason.

A solution that is fast and doesn't panic is desirable.


closes #84448
closes #86470

@the8472 the8472 added the T-libs-api Relevant to the library API team, which will review and decide on the PR/issue. label Oct 15, 2021
@rust-highfive
Copy link
Collaborator

r? @Mark-Simulacrum

(rust-highfive has picked a reviewer for you, use r? to override)

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Oct 15, 2021
@rust-log-analyzer

This comment has been minimized.

@jhpratt
Copy link
Member

jhpratt commented Oct 16, 2021

If I have instant2.duration_since(instant1) == Duration::from_secs(0), logic would say that instant1 == instant2. If the operation saturates, this invariant would no longer be upheld. Making elapsed saturate instead of panic has similar issues as you can mutate an Instant (via add-assigning a Duration).

As mentioned,

non-monotonic intervals will not be associative, i.e. b.duration_since(a) + c.duration_since(b) != c.duration_since(a)

I don't think anyone would expect that the two sides would be unequal in any situation. duration_since realistically only exists because implementing Sub would be a footgun. I fear that this may be on the same level.


While I understand the motivation, I don't think breaking logical invariants (even if not explicitly stated) is a reasonable solution.

@joshtriplett
Copy link
Member

I love the idea of making this change, and removing all the associated complexity and panics.

I think in the common case people won't get two instants backwards, because they can call start.elapsed() rather than calling Instant::now() again. I can imagine cases motivating a second call to Instant::now() (e.g. making sure several durations are back-to-back by using the end of one interval as the start of the next), but it still seems acceptable to not catch reversing the two. It might also be possible to implement a simple lint for common cases.

I don't think this would affect any invariants people rely on in practice. And people can always call checked_duration_since(...).expect(...) if they want a panic.

@nagisa
Copy link
Member

nagisa commented Oct 17, 2021

Is there any reason why we might want to keep actually_monotonic in places and continue using a simple wrapping subtraction instead of a saturating one on those platforms?

@the8472
Copy link
Member Author

the8472 commented Oct 17, 2021

Currently there is no wrapping subtraction available on the sys::time::Instant implementations because on many platforms it's a composite type consisting of separate seconds and nanos fields. Only checked add/sub are provided.
Only the solid/itron target uses an Instant that's a single u64 field.

@bors
Copy link
Contributor

bors commented Oct 17, 2021

☔ The latest upstream changes (presumably #88652) made this pull request unmergeable. Please resolve the merge conflicts.

@Mark-Simulacrum Mark-Simulacrum added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Oct 17, 2021
@BurntSushi
Copy link
Member

Initially, my main concern was that this silences potentially important failure modes. Namely, I can imagine someone relying on the fact that Instant::duration_since will panic if the underlying clock is not actually monotonic. But it looks like we're already trying to paper over that with a work-around that would silence such a failure mode anyway. So I guess that's not a new issue introduced by this change?

Changing algebraic laws also doesn't feel that great to me either. Technically they aren't documented, although a reasonable person might infer them from the panicking conditions of duration_since.

For those that understand this issue better than me: what is the cost of not doing this?

@the8472
Copy link
Member Author

the8472 commented Oct 18, 2021

For those that understand this issue better than me: what is the cost of not doing this?

  • sporadic panics on systems marked as actually_monotonic() == true
  • contention and overhead due to the monotonizing mechanism on systems marked actually_monotonic() == false, for something that should be a very-low-overhead, contention-free clock source on modern systems.
  • implementation complexity
  • ongoing maintenance adjusting actually_monotonic() as affected systems get retired or new ones are added

@BurntSushi
Copy link
Member

* spurious panics on systems marked as `actually_monotonic() == true`

I think this is the one that interests me to the most. Although I am perhaps wrong to find this one interesting. In particular---while again acknowledging that I don't work in such a domain---I would imagine that such a panic would be highly interesting to someone that wants a strong guarantee about monotonicity. That is, they might have written their code in a way where they want to see a panic if the underlying clock source didn't produce monotonic values. Maybe they should have used checked_duration_since for this, but duration_since is currently documented to panic in such cases, so they might have reasoned that it was acceptable to use in such a circumstance. AIUI, this patch will translate that from an expected explicit failure scenario to an unexpected silent failure.

With that said, I am pretty much reasoning in the abstract here. I don't have enough experience to put my feet on the ground here. The silent failure mode does concern me, but maybe my abstract reasoning is too much of a stretch.

If we have folks working with the guarantees of monotonic clocks in production that we could ping, getting their input on a change like this would probably be wise.

@joshtriplett joshtriplett added the I-libs-api-nominated Nominated for discussion during a libs-api team meeting. label Oct 20, 2021
@the8472 the8472 force-pushed the saturate-instant branch 2 times, most recently from 0f1b815 to 777e339 Compare October 20, 2021 20:39
@the8472
Copy link
Member Author

the8472 commented Oct 20, 2021

As discussed in the libs-api meeting I have changed the methods to panic in debug mode (via overflow-checks) and saturate in release mode.

Discussion on exactly which of {duration_since, elapsed, sub} should saturate or panic is still open.

library/std/src/time.rs Outdated Show resolved Hide resolved
@matklad
Copy link
Member

matklad commented Oct 30, 2021

I think we hit "time goes backwards in a VM" bug in NEAR: https://near.zulipchat.com/#narrow/stream/295302-dev-general/topic/general/near/248247028. So, for us, such a change would be very much welcome.

However, there's a wrinkle -- we compile our code in --release mode, but with overflow checks on. That is:

  • We do want to panic due to "logical errors" with arithmetics
  • If the underlying hardware/hypervisor/OS breaks monotonicity guarantees, we don't want to panic

For --release,overflow-checks = true, I fear that this specific implementation would be problematic -- it'll lead to strictly more panics than we have today (as we remove is_actually_monotonic check).

Ideally, I think we shouldn't be piggybacking on overflow-checks here, but instead used cfg!(debug_assertions). But of course it's not something we can do in std.

To sum up:

  • I really like "panic in debug, saturate in release" approach, as it improves both reliability and performance
  • The specific overflow_checks approach seems to make --release,overflow-checks = true more panicky, and that feels like a major regression.
  • don't know how to what alternative impl approach would be better here though.

@the8472
Copy link
Member Author

the8472 commented Oct 30, 2021

I think we hit "time goes backwards in a VM" bug in NEAR

If you're already hitting those panics that should mean that actually_monotonic() == false on your platform and the hardware clock is getting passed through unfiltered. So this change wouldn't make things worse for you, you just wouldn't get the intended benefits.

Also, that link would require signup to read it.


Depending on how much control you have over where the Instant's are compared maybe you could selectively change the overflow-checks flag for those crates via profile overrides?

@matklad
Copy link
Member

matklad commented Oct 30, 2021

Yeah, practically for near specifically I think we currently only run on is_actually_monotonic platforms. But in general any code which is compiled with release,overflow-checks=true mode and is run on !is_actually_monotonic platform will see more panics. Can't point to specific projects which use this scenario, but I'd be surprised if there aren't any.

Also, that link would require signup to read it.

Oups, good catch! That's the usual Zulip's "login with GitHub" thing, we should set-up zulip archive. The short discussion here basically just links to tokio-rs/tokio#3619

@bors
Copy link
Contributor

bors commented Oct 31, 2021

☔ The latest upstream changes (presumably #90437) made this pull request unmergeable. Please resolve the merge conflicts.

@rust-log-analyzer

This comment has been minimized.

@bors
Copy link
Contributor

bors commented Feb 13, 2022

📌 Commit 37a1fc5 has been approved by Mark-Simulacrum

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Feb 13, 2022
bors added a commit to rust-lang-ci/rust that referenced this pull request Feb 13, 2022
…askrgr

Rollup of 9 pull requests

Successful merges:

 - rust-lang#89926 (make `Instant::{duration_since, elapsed, sub}` saturating and remove workarounds)
 - rust-lang#90532 (More informative error message for E0015)
 - rust-lang#93810 (Improve chalk integration)
 - rust-lang#93851 (More practical examples for `Option::and_then` & `Result::and_then`)
 - rust-lang#93885 (bootstrap.py: Suggest disabling download-ci-llvm option if url fails to download)
 - rust-lang#93886 (Stabilise inherent_ascii_escape (FCP in rust-lang#77174))
 - rust-lang#93930 (add link to format_args! when mention it in docs)
 - rust-lang#93936 (Couple of driver cleanups)
 - rust-lang#93944 (Don't relabel to a team if there is already a team label)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit 92613a2 into rust-lang:master Feb 13, 2022
@rustbot rustbot added this to the 1.60.0 milestone Feb 13, 2022
@uazu
Copy link

uazu commented Feb 17, 2022

Seeing this on Rust Weekly News gave me a shock. So Instant::now() is no longer guaranteed non-decreasing? I think people need a heads-up about this. I think there are cases where this could break people's assumptions about ordering of operations, for example if I set two timers at one second from now, setting them from times 1ms apart, they could execute in the opposite order. This could break some assumptions the coder is relying on, for example if both of these timers update the same state, with the assumption that the second timer will execute second, then the state could be left with an intermediate value.

I just checked my code, and I don't use Instant::now() directly, but I keep a local copy which already has checks so that it can't go backwards (i.e. I already don't trust Instant::now()), so my code is okay. I wonder whether it's possible to judge whether this will break things for anyone else. I am in favour of the change, because getting rid of that overhead is an advantage. But if it is a breaking change for anyone, they need to know.

I'm trying to think of the cases where this could break. Maybe when two ordered events come in from an external source, e.g. from hardware or over a network stream, and two timers are set from those events, and then the timers execute in the opposite order, breaking the coder's assumptions. For this to have worked in the case of the previous Instant implementation, the timer queue would need to maintain the order of timers submitted for the same Instant, but if it did then this would be a breaking change for that coder. If this sounds unlikely to happen in real life code, then perhaps everything is okay.

Edit: Really it comes down to whether there are scenarios that would have worked with the previous implementation that won't work now. Thinking about it, in practice the time getting stuck on the same value for Z ms can also give unexpected problems.

@the8472
Copy link
Member Author

the8472 commented Feb 17, 2022

So Instant is no longer guaranteed non-decreasing?

From the updated docs

Instants are always guaranteed, barring platform bugs, to be no less than any previously measured instant when created, and are often useful for tasks such as measuring benchmarks or timing how long an operation takes.

From an API perspective Rust already relied on the OS guarantees to provide monotonic time. It additionally applies some workarounds that are only relevant in situations when operating system fails to uphold its contract. What changed are the workarounds. What doesn't change is that any violation of monotonicity already is a platform bug, i.e. running rust on a broken system. This is akin to, albeit less severe, a filesystem not upholding its durability guarantees for example.

@uazu
Copy link

uazu commented Feb 17, 2022

From an API perspective Rust already relied on the OS guarantees to provide monotonic time. It additionally applies some workarounds that are only relevant in situations when operating system fails to uphold its contract. What changed are the workarounds. What doesn't change is that any violation of monotonicity already is a platform bug, i.e. running rust on a broken system. This is akin to, albeit less severe, a filesystem not upholding its durability guarantees for example.

I understand that. However if a coder requires a strictly non-decreasing Instant (e.g. for their code to operate correctly), previously they could have relied on Rust's implementation to do the work-around in case of platform bugs. Now they need to do the work-around themselves. Maybe that's a reasonable thing to ask them to do, but at least they'll need a heads-up so that they can check their code (as I did), e.g. a warning in the Rust release notes or something.

@cuviper
Copy link
Member

cuviper commented Feb 17, 2022

This is labeled relnotes already, but please feel free to check on that when we're drafting 1.60.0.

@nyetwurk
Copy link

IMO what is missing from this thread is any mention of pressuring vendors that have known broken VM/hypervisors in production (AWS). Hiding this is enabling their continued bad behavior.

@the8472
Copy link
Member Author

the8472 commented Feb 17, 2022

However if a coder requires a strictly non-decreasing Instant (e.g. for their code to operate correctly), previously they could have relied on Rust's implementation to do the work-around in case of platform bugs. Now they need to do the work-around themselves.

If it is a strict requirement then using a system that isn't broken should be preferable. As it is preferable to put some critical transactional database on storage which honors FLUSH CACHE commands rather than putting a on a drive that YOLOs things (and thus isn't spec-compliant).

IMO what is missing from this thread is any mention of pressuring vendors that have known broken VM/hypervisors in production (AWS). Hiding this is enabling their continued bad behavior.

Well, users did encounter panics and filed bug reports with Rust but not with AWS. Or if they did they went unheard I guess.
"Panics will continue until compliance improves" is a possible strategy but not one that fits Rust's MO.

If there's an interest in stress-testing clocks on new hardware this could be done with a standalone program, similar to memory or GPU stress testing programs. It doesn't have to happen in production software.

bors bot added a commit to nervosnetwork/ckb that referenced this pull request Feb 21, 2022
3308: chore: fix instant panic on some case r=zhangsoledad a=driftluo

### What problem does this PR solve?

ref: rust-lang/rust#89926

upgrade tokio/tentacle/parking_lot

tokio:
```
### Fixed

- time: prevent panicking in `sleep` with large durations ([#4495])
- time: eliminate potential panics in `Instant` arithmetic on platforms where
  `Instant::now` is not monotonic ([#4461])
- io: fix `DuplexStream` not participating in cooperative yielding ([#4478])
- rt: fix potential double panic when dropping a `JoinHandle` ([#4430])

### Changed

- update minimum supported Rust version to 1.49 ([#4457])
- update `parking_lot` dependency to v0.12.0 ([#4459])
- update `mio` dependency to v0.8 ([#4449])
- rt: remove an unnecessary lock in the blocking pool ([#4436])
- rt: remove an unnecessary enum in the basic scheduler ([#4462])
- time: use bit manipulation instead of modulo to improve performance ([#4480])
- net: use `std::future::Ready` instead of our own `Ready` future ([#4271])
- replace deprecated `atomic::spin_loop_hint` with `hint::spin_loop` ([#4491])
- fix miri failures in intrusive linked lists ([#4397]) 
```

### Check List

Tests

- Unit test
- Integration test

### Release note

```release-note
Title Only: Include only the PR title in the release note.
```



Co-authored-by: driftluo <driftluo@foxmail.com>
sunfishcode added a commit to bytecodealliance/cap-std that referenced this pull request Feb 22, 2022
As of rust-lang/rust#89926, this test behaves differently. We support
rust versions before and after this change, so both behaviors are
possible, so just disable this test for now.
sunfishcode added a commit to bytecodealliance/cap-std that referenced this pull request Feb 28, 2022
As of rust-lang/rust#89926, this test behaves differently. We support
rust versions before and after this change, so both behaviors are
possible, so just disable this test for now.
wip-sync pushed a commit to NetBSD/pkgsrc-wip that referenced this pull request Apr 15, 2022
Pkgsrc changes:
 * Bump available bootstraps to 1.59.0.
 * Delete one patch which no longer applies,
   adjust another.

Upstream changes:

Version 1.60.0 (2022-04-07)
==========================

Language
--------
- [Stabilize `#[cfg(panic = "...")]` for either `"unwind"` or `"abort"`.]
  [93658]
- [Stabilize `#[cfg(target_has_atomic = "...")]` for each integer
  size and `"ptr"`.][93824]

Compiler
--------
- [Enable combining `+crt-static` and `relocation-model=pic` on
  `x86_64-unknown-linux-gnu`][86374]
- [Fixes wrong `unreachable_pub` lints on nested and glob public
  reexport][87487]
- [Stabilize `-Z instrument-coverage` as `-C instrument-coverage`][90132]
- [Stabilize `-Z print-link-args` as `--print link-args`][91606]
- [Add new Tier 3 target `mips64-openwrt-linux-musl`\*][92300]
- [Add new Tier 3 target `armv7-unknown-linux-uclibceabi` (softfloat)\*][92383]
- [Fix invalid removal of newlines from doc comments][92357]
- [Add kernel target for RustyHermit][92670]
- [Deny mixing bin crate type with lib crate types][92933]
- [Make rustc use `RUST_BACKTRACE=full` by default][93566]
- [Upgrade to LLVM 14][93577]

\* Refer to Rust's [platform support page][platform-support-doc] for more
   information on Rust's tiered platform support.

Libraries
---------
- [Guarantee call order for `sort_by_cached_key`][89621]
- [Improve `Duration::try_from_secs_f32`/`f64` accuracy by directly
  processing exponent and mantissa][90247]
- [Make `Instant::{duration_since, elapsed, sub}` saturating][89926]
- [Remove non-monotonic clocks workarounds in `Instant::now`][89926]
- [Make `BuildHasherDefault`, `iter::Empty` and `future::Pending`
  covariant][92630]

Stabilized APIs
---------------
- [`Arc::new_cyclic`][arc_new_cyclic]
- [`Rc::new_cyclic`][rc_new_cyclic]
- [`slice::EscapeAscii`][slice_escape_ascii]
- [`<[u8]>::escape_ascii`][slice_u8_escape_ascii]
- [`u8::escape_ascii`][u8_escape_ascii]
- [`Vec::spare_capacity_mut`][vec_spare_capacity_mut]
- [`MaybeUninit::assume_init_drop`][assume_init_drop]
- [`MaybeUninit::assume_init_read`][assume_init_read]
- [`i8::abs_diff`][i8_abs_diff]
- [`i16::abs_diff`][i16_abs_diff]
- [`i32::abs_diff`][i32_abs_diff]
- [`i64::abs_diff`][i64_abs_diff]
- [`i128::abs_diff`][i128_abs_diff]
- [`isize::abs_diff`][isize_abs_diff]
- [`u8::abs_diff`][u8_abs_diff]
- [`u16::abs_diff`][u16_abs_diff]
- [`u32::abs_diff`][u32_abs_diff]
- [`u64::abs_diff`][u64_abs_diff]
- [`u128::abs_diff`][u128_abs_diff]
- [`usize::abs_diff`][usize_abs_diff]
- [`Display for io::ErrorKind`][display_error_kind]
- [`From<u8> for ExitCode`][from_u8_exit_code]
- [`Not for !` (the "never" type)][not_never]
- [_Op_`Assign<$t> for Wrapping<$t>`][wrapping_assign_ops]
- [`arch::is_aarch64_feature_detected!`][is_aarch64_feature_detected]

Cargo
-----
- [Port cargo from `toml-rs` to `toml_edit`][cargo/10086]
- [Stabilize `-Ztimings` as `--timings`][cargo/10245]
- [Stabilize namespaced and weak dependency features.][cargo/10269]
- [Accept more `cargo:rustc-link-arg-*` types from build script
  output.][cargo/10274]
- [cargo-new should not add ignore rule on Cargo.lock inside
  subdirs][cargo/10379]

Misc
----
- [Ship docs on Tier 2 platforms by reusing the closest Tier 1
  platform docs][92800]
- [Drop rustc-docs from complete profile][93742]
- [bootstrap: tidy up flag handling for llvm build][93918]

Compatibility Notes
-------------------
- [Remove compiler-rt linking hack on Android][83822]
- [Mitigations for platforms with non-monotonic clocks have been removed from
  `Instant::now`][89926]. On platforms that don't provide monotonic clocks, an
  instant is not guaranteed to be greater than an earlier instant anymore.
- [`Instant::{duration_since, elapsed, sub}` do not panic anymore on underflow,
  saturating to `0` instead][89926]. In the real world the panic happened mostly
  on platforms with buggy monotonic clock implementations rather than catching
  programming errors like reversing the start and end times. Such programming
  errors will now results in `0` rather than a panic.
- In a future release we're planning to increase the baseline requirements for
  the Linux kernel to version 3.2, and for glibc to version 2.17. We'd love
  your feedback in [PR #95026][95026].

Internal Changes
----------------

These changes provide no direct user facing benefits, but represent
significant improvements to the internals and overall performance
of rustc and related tools.

- [Switch all libraries to the 2021 edition][92068]

[83822]: rust-lang/rust#83822
[86374]: rust-lang/rust#86374
[87487]: rust-lang/rust#87487
[89621]: rust-lang/rust#89621
[89926]: rust-lang/rust#89926
[90132]: rust-lang/rust#90132
[90247]: rust-lang/rust#90247
[91606]: rust-lang/rust#91606
[92068]: rust-lang/rust#92068
[92300]: rust-lang/rust#92300
[92357]: rust-lang/rust#92357
[92383]: rust-lang/rust#92383
[92630]: rust-lang/rust#92630
[92670]: rust-lang/rust#92670
[92800]: rust-lang/rust#92800
[92933]: rust-lang/rust#92933
[93566]: rust-lang/rust#93566
[93577]: rust-lang/rust#93577
[93658]: rust-lang/rust#93658
[93742]: rust-lang/rust#93742
[93824]: rust-lang/rust#93824
[93918]: rust-lang/rust#93918
[95026]: rust-lang/rust#95026

[cargo/10086]: rust-lang/cargo#10086
[cargo/10245]: rust-lang/cargo#10245
[cargo/10269]: rust-lang/cargo#10269
[cargo/10274]: rust-lang/cargo#10274
[cargo/10379]: rust-lang/cargo#10379

[arc_new_cyclic]: https://doc.rust-lang.org/stable/std/sync/struct.Arc.html#method.new_cyclic
[rc_new_cyclic]: https://doc.rust-lang.org/stable/std/rc/struct.Rc.html#method.new_cyclic
[slice_escape_ascii]: https://doc.rust-lang.org/stable/std/slice/struct.EscapeAscii.html
[slice_u8_escape_ascii]: https://doc.rust-lang.org/stable/std/primitive.slice.html#method.escape_ascii
[u8_escape_ascii]: https://doc.rust-lang.org/stable/std/primitive.u8.html#method.escape_ascii
[vec_spare_capacity_mut]: https://doc.rust-lang.org/stable/std/vec/struct.Vec.html#method.spare_capacity_mut
[assume_init_drop]: https://doc.rust-lang.org/stable/std/mem/union.MaybeUninit.html#method.assume_init_drop
[assume_init_read]: https://doc.rust-lang.org/stable/std/mem/union.MaybeUninit.html#method.assume_init_read
[i8_abs_diff]: https://doc.rust-lang.org/stable/std/primitive.i8.html#method.abs_diff
[i16_abs_diff]: https://doc.rust-lang.org/stable/std/primitive.i16.html#method.abs_diff
[i32_abs_diff]: https://doc.rust-lang.org/stable/std/primitive.i32.html#method.abs_diff
[i64_abs_diff]: https://doc.rust-lang.org/stable/std/primitive.i64.html#method.abs_diff
[i128_abs_diff]: https://doc.rust-lang.org/stable/std/primitive.i128.html#method.abs_diff
[isize_abs_diff]: https://doc.rust-lang.org/stable/std/primitive.isize.html#method.abs_diff
[u8_abs_diff]: https://doc.rust-lang.org/stable/std/primitive.u8.html#method.abs_diff
[u16_abs_diff]: https://doc.rust-lang.org/stable/std/primitive.u16.html#method.abs_diff
[u32_abs_diff]: https://doc.rust-lang.org/stable/std/primitive.u32.html#method.abs_diff
[u64_abs_diff]: https://doc.rust-lang.org/stable/std/primitive.u64.html#method.abs_diff
[u128_abs_diff]: https://doc.rust-lang.org/stable/std/primitive.u128.html#method.abs_diff
[usize_abs_diff]: https://doc.rust-lang.org/stable/std/primitive.usize.html#method.abs_diff
[display_error_kind]: https://doc.rust-lang.org/stable/std/io/enum.ErrorKind.html#impl-Display
[from_u8_exit_code]: https://doc.rust-lang.org/stable/std/process/struct.ExitCode.html#impl-From%3Cu8%3E
[not_never]: https://doc.rust-lang.org/stable/std/primitive.never.html#impl-Not
[wrapping_assign_ops]: https://doc.rust-lang.org/stable/std/num/struct.Wrapping.html#trait-implementations
[is_aarch64_feature_detected]: https://doc.rust-lang.org/stable/std/arch/macro.is_aarch64_feature_detected.html
netbsd-srcmastr pushed a commit to NetBSD/pkgsrc that referenced this pull request May 25, 2022
Pkgsrc changes:
 * Bump available bootstraps to 1.59.0.
 * Adjust line number in patches which had non-zero offsets.

Upstream changes:

Version 1.60.0 (2022-04-07)
===========================

Language
--------
- [Stabilize `#[cfg(panic = "...")]` for either `"unwind"` or `"abort"`.]
  [93658]
- [Stabilize `#[cfg(target_has_atomic = "...")]` for each integer
  size and `"ptr"`.][93824]

Compiler
--------
- [Enable combining `+crt-static` and `relocation-model=pic` on
  `x86_64-unknown-linux-gnu`][86374]
- [Fixes wrong `unreachable_pub` lints on nested and glob public
  reexport][87487]
- [Stabilize `-Z instrument-coverage` as `-C instrument-coverage`][90132]
- [Stabilize `-Z print-link-args` as `--print link-args`][91606]
- [Add new Tier 3 target `mips64-openwrt-linux-musl`\*][92300]
- [Add new Tier 3 target `armv7-unknown-linux-uclibceabi` (softfloat)\*][92383]
- [Fix invalid removal of newlines from doc comments][92357]
- [Add kernel target for RustyHermit][92670]
- [Deny mixing bin crate type with lib crate types][92933]
- [Make rustc use `RUST_BACKTRACE=full` by default][93566]
- [Upgrade to LLVM 14][93577]

\* Refer to Rust's [platform support page][platform-support-doc] for more
   information on Rust's tiered platform support.

Libraries
---------
- [Guarantee call order for `sort_by_cached_key`][89621]
- [Improve `Duration::try_from_secs_f32`/`f64` accuracy by directly
  processing exponent and mantissa][90247]
- [Make `Instant::{duration_since, elapsed, sub}` saturating][89926]
- [Remove non-monotonic clocks workarounds in `Instant::now`][89926]
- [Make `BuildHasherDefault`, `iter::Empty` and `future::Pending`
  covariant][92630]

Stabilized APIs
---------------
- [`Arc::new_cyclic`][arc_new_cyclic]
- [`Rc::new_cyclic`][rc_new_cyclic]
- [`slice::EscapeAscii`][slice_escape_ascii]
- [`<[u8]>::escape_ascii`][slice_u8_escape_ascii]
- [`u8::escape_ascii`][u8_escape_ascii]
- [`Vec::spare_capacity_mut`][vec_spare_capacity_mut]
- [`MaybeUninit::assume_init_drop`][assume_init_drop]
- [`MaybeUninit::assume_init_read`][assume_init_read]
- [`i8::abs_diff`][i8_abs_diff]
- [`i16::abs_diff`][i16_abs_diff]
- [`i32::abs_diff`][i32_abs_diff]
- [`i64::abs_diff`][i64_abs_diff]
- [`i128::abs_diff`][i128_abs_diff]
- [`isize::abs_diff`][isize_abs_diff]
- [`u8::abs_diff`][u8_abs_diff]
- [`u16::abs_diff`][u16_abs_diff]
- [`u32::abs_diff`][u32_abs_diff]
- [`u64::abs_diff`][u64_abs_diff]
- [`u128::abs_diff`][u128_abs_diff]
- [`usize::abs_diff`][usize_abs_diff]
- [`Display for io::ErrorKind`][display_error_kind]
- [`From<u8> for ExitCode`][from_u8_exit_code]
- [`Not for !` (the "never" type)][not_never]
- [_Op_`Assign<$t> for Wrapping<$t>`][wrapping_assign_ops]
- [`arch::is_aarch64_feature_detected!`][is_aarch64_feature_detected]

Cargo
-----
- [Port cargo from `toml-rs` to `toml_edit`][cargo/10086]
- [Stabilize `-Ztimings` as `--timings`][cargo/10245]
- [Stabilize namespaced and weak dependency features.][cargo/10269]
- [Accept more `cargo:rustc-link-arg-*` types from build script
  output.][cargo/10274]
- [cargo-new should not add ignore rule on Cargo.lock inside
  subdirs][cargo/10379]

Misc
----
- [Ship docs on Tier 2 platforms by reusing the closest Tier 1
  platform docs][92800]
- [Drop rustc-docs from complete profile][93742]
- [bootstrap: tidy up flag handling for llvm build][93918]

Compatibility Notes
-------------------
- [Remove compiler-rt linking hack on Android][83822]
- [Mitigations for platforms with non-monotonic clocks have been removed from
  `Instant::now`][89926]. On platforms that don't provide monotonic clocks, an
  instant is not guaranteed to be greater than an earlier instant anymore.
- [`Instant::{duration_since, elapsed, sub}` do not panic anymore on underflow,
  saturating to `0` instead][89926]. In the real world the panic happened mostly
  on platforms with buggy monotonic clock implementations rather than catching
  programming errors like reversing the start and end times. Such programming
  errors will now results in `0` rather than a panic.
- In a future release we're planning to increase the baseline requirements for
  the Linux kernel to version 3.2, and for glibc to version 2.17. We'd love
  your feedback in [PR #95026][95026].

Internal Changes
----------------

These changes provide no direct user facing benefits, but represent
significant improvements to the internals and overall performance
of rustc and related tools.

- [Switch all libraries to the 2021 edition][92068]

[83822]: rust-lang/rust#83822
[86374]: rust-lang/rust#86374
[87487]: rust-lang/rust#87487
[89621]: rust-lang/rust#89621
[89926]: rust-lang/rust#89926
[90132]: rust-lang/rust#90132
[90247]: rust-lang/rust#90247
[91606]: rust-lang/rust#91606
[92068]: rust-lang/rust#92068
[92300]: rust-lang/rust#92300
[92357]: rust-lang/rust#92357
[92383]: rust-lang/rust#92383
[92630]: rust-lang/rust#92630
[92670]: rust-lang/rust#92670
[92800]: rust-lang/rust#92800
[92933]: rust-lang/rust#92933
[93566]: rust-lang/rust#93566
[93577]: rust-lang/rust#93577
[93658]: rust-lang/rust#93658
[93742]: rust-lang/rust#93742
[93824]: rust-lang/rust#93824
[93918]: rust-lang/rust#93918
[95026]: rust-lang/rust#95026

[cargo/10086]: rust-lang/cargo#10086
[cargo/10245]: rust-lang/cargo#10245
[cargo/10269]: rust-lang/cargo#10269
[cargo/10274]: rust-lang/cargo#10274
[cargo/10379]: rust-lang/cargo#10379

[arc_new_cyclic]: https://doc.rust-lang.org/stable/std/sync/struct.Arc.html#method.new_cyclic
[rc_new_cyclic]: https://doc.rust-lang.org/stable/std/rc/struct.Rc.html#method.new_cyclic
[slice_escape_ascii]: https://doc.rust-lang.org/stable/std/slice/struct.EscapeAscii.html
[slice_u8_escape_ascii]: https://doc.rust-lang.org/stable/std/primitive.slice.html#method.escape_ascii
[u8_escape_ascii]: https://doc.rust-lang.org/stable/std/primitive.u8.html#method.escape_ascii
[vec_spare_capacity_mut]: https://doc.rust-lang.org/stable/std/vec/struct.Vec.html#method.spare_capacity_mut
[assume_init_drop]: https://doc.rust-lang.org/stable/std/mem/union.MaybeUninit.html#method.assume_init_drop
[assume_init_read]: https://doc.rust-lang.org/stable/std/mem/union.MaybeUninit.html#method.assume_init_read
[i8_abs_diff]: https://doc.rust-lang.org/stable/std/primitive.i8.html#method.abs_diff
[i16_abs_diff]: https://doc.rust-lang.org/stable/std/primitive.i16.html#method.abs_diff
[i32_abs_diff]: https://doc.rust-lang.org/stable/std/primitive.i32.html#method.abs_diff
[i64_abs_diff]: https://doc.rust-lang.org/stable/std/primitive.i64.html#method.abs_diff
[i128_abs_diff]: https://doc.rust-lang.org/stable/std/primitive.i128.html#method.abs_diff
[isize_abs_diff]: https://doc.rust-lang.org/stable/std/primitive.isize.html#method.abs_diff
[u8_abs_diff]: https://doc.rust-lang.org/stable/std/primitive.u8.html#method.abs_diff
[u16_abs_diff]: https://doc.rust-lang.org/stable/std/primitive.u16.html#method.abs_diff
[u32_abs_diff]: https://doc.rust-lang.org/stable/std/primitive.u32.html#method.abs_diff
[u64_abs_diff]: https://doc.rust-lang.org/stable/std/primitive.u64.html#method.abs_diff
[u128_abs_diff]: https://doc.rust-lang.org/stable/std/primitive.u128.html#method.abs_diff
[usize_abs_diff]: https://doc.rust-lang.org/stable/std/primitive.usize.html#method.abs_diff
[display_error_kind]: https://doc.rust-lang.org/stable/std/io/enum.ErrorKind.html#impl-Display
[from_u8_exit_code]: https://doc.rust-lang.org/stable/std/process/struct.ExitCode.html#impl-From%3Cu8%3E
[not_never]: https://doc.rust-lang.org/stable/std/primitive.never.html#impl-Not
[wrapping_assign_ops]: https://doc.rust-lang.org/stable/std/num/struct.Wrapping.html#trait-implementations
[is_aarch64_feature_detected]: https://doc.rust-lang.org/stable/std/arch/macro.is_aarch64_feature_detected.html
@saethlin saethlin mentioned this pull request Jul 22, 2022
snev68 added a commit to snev68/cap-std that referenced this pull request Aug 5, 2024
As of rust-lang/rust#89926, this test behaves differently. We support
rust versions before and after this change, so both behaviors are
possible, so just disable this test for now.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
disposition-merge This issue / PR is in PFCP or FCP with a disposition to merge it. finished-final-comment-period The final comment period is finished for this PR / Issue. relnotes Marks issues that should be documented in the release notes of the next release. S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-libs-api Relevant to the library API team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

supplied instant is later than self