diff options
| author | Mara Bos <m-ou.se@m-ou.se> | 2021-04-26 21:06:46 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-04-26 21:06:46 +0200 |
| commit | fb1502d5704fca76e63416663f64c6f89a52942b (patch) | |
| tree | eebdd3588c30ae6e7aa9b3f7566547a34a666ee0 | |
| parent | 154858c4308d771e29ad90057bf199867c271d09 (diff) | |
| parent | 8278380047c05539daf404adc17018de4570ddde (diff) | |
| download | rust-fb1502d5704fca76e63416663f64c6f89a52942b.tar.gz rust-fb1502d5704fca76e63416663f64c6f89a52942b.zip | |
Rollup merge of #84120 - workingjubilee:stabilize-duration-max, r=m-ou-se
Stabilize Duration::MAX Following the suggested direction from https://github.com/rust-lang/rust/issues/76416#issuecomment-817278338, this PR proposes that `Duration::MAX` should have been part of the `duration_saturating_ops` feature flag all along, having been 0. heavily referenced by that feature flag 1. an odd duck next to most of `duration_constants`, as I expressed in https://github.com/rust-lang/rust/issues/57391#issuecomment-717681193 2. introduced in #76114 which added `duration_saturating_ops` and accordingly should be folded into `duration_saturating_ops` and therefore stabilized. r? `@m-ou-se`
| -rw-r--r-- | library/core/src/time.rs | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/library/core/src/time.rs b/library/core/src/time.rs index fa6a6c2cccc..bfea39e3211 100644 --- a/library/core/src/time.rs +++ b/library/core/src/time.rs @@ -135,17 +135,21 @@ impl Duration { /// The maximum duration. /// - /// It is roughly equal to a duration of 584,942,417,355 years. + /// May vary by platform as necessary. Must be able to contain the difference between + /// two instances of [`Instant`] or two instances of [`SystemTime`]. + /// This constraint gives it a value of about 584,942,417,355 years in practice, + /// which is currently used on all platforms. /// /// # Examples /// /// ``` - /// #![feature(duration_constants)] /// use std::time::Duration; /// /// assert_eq!(Duration::MAX, Duration::new(u64::MAX, 1_000_000_000 - 1)); /// ``` - #[unstable(feature = "duration_constants", issue = "57391")] + /// [`Instant`]: ../../std/time/struct.Instant.html + /// [`SystemTime`]: ../../std/time/struct.SystemTime.html + #[stable(feature = "duration_saturating_ops", since = "1.53.0")] pub const MAX: Duration = Duration::new(u64::MAX, NANOS_PER_SEC - 1); /// Creates a new `Duration` from the specified number of whole seconds and |
