Skip to content

Commit fb1502d

Browse files
authored
Rollup merge of #84120 - workingjubilee:stabilize-duration-max, r=m-ou-se
Stabilize Duration::MAX Following the suggested direction from #76416 (comment), 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 #57391 (comment) 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`
2 parents 154858c + 8278380 commit fb1502d

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

library/core/src/time.rs

+7-3
Original file line numberDiff line numberDiff line change
@@ -135,17 +135,21 @@ impl Duration {
135135

136136
/// The maximum duration.
137137
///
138-
/// It is roughly equal to a duration of 584,942,417,355 years.
138+
/// May vary by platform as necessary. Must be able to contain the difference between
139+
/// two instances of [`Instant`] or two instances of [`SystemTime`].
140+
/// This constraint gives it a value of about 584,942,417,355 years in practice,
141+
/// which is currently used on all platforms.
139142
///
140143
/// # Examples
141144
///
142145
/// ```
143-
/// #![feature(duration_constants)]
144146
/// use std::time::Duration;
145147
///
146148
/// assert_eq!(Duration::MAX, Duration::new(u64::MAX, 1_000_000_000 - 1));
147149
/// ```
148-
#[unstable(feature = "duration_constants", issue = "57391")]
150+
/// [`Instant`]: ../../std/time/struct.Instant.html
151+
/// [`SystemTime`]: ../../std/time/struct.SystemTime.html
152+
#[stable(feature = "duration_saturating_ops", since = "1.53.0")]
149153
pub const MAX: Duration = Duration::new(u64::MAX, NANOS_PER_SEC - 1);
150154

151155
/// Creates a new `Duration` from the specified number of whole seconds and

0 commit comments

Comments
 (0)