diff --git a/src/libstd/time.rs b/src/libstd/time.rs index 23924559fcc24..b63d816ce44ca 100644 --- a/src/libstd/time.rs +++ b/src/libstd/time.rs @@ -245,17 +245,17 @@ impl Instant { /// Returns `Some(t)` where `t` is the time `self + duration` if `t` can be represented as /// `Instant` (which means it's inside the bounds of the underlying data structure), `None` /// otherwise. - #[unstable(feature = "time_checked_add", issue = "55940")] + #[stable(feature = "time_checked_add", since = "1.34.0")] pub fn checked_add(&self, duration: Duration) -> Option { - self.0.checked_add_duration(&duration).map(|t| Instant(t)) + self.0.checked_add_duration(&duration).map(Instant) } /// Returns `Some(t)` where `t` is the time `self - duration` if `t` can be represented as /// `Instant` (which means it's inside the bounds of the underlying data structure), `None` /// otherwise. - #[unstable(feature = "time_checked_add", issue = "55940")] + #[stable(feature = "time_checked_add", since = "1.34.0")] pub fn checked_sub(&self, duration: Duration) -> Option { - self.0.checked_sub_duration(&duration).map(|t| Instant(t)) + self.0.checked_sub_duration(&duration).map(Instant) } } @@ -418,17 +418,17 @@ impl SystemTime { /// Returns `Some(t)` where `t` is the time `self + duration` if `t` can be represented as /// `SystemTime` (which means it's inside the bounds of the underlying data structure), `None` /// otherwise. - #[unstable(feature = "time_checked_add", issue = "55940")] + #[stable(feature = "time_checked_add", since = "1.34.0")] pub fn checked_add(&self, duration: Duration) -> Option { - self.0.checked_add_duration(&duration).map(|t| SystemTime(t)) + self.0.checked_add_duration(&duration).map(SystemTime) } /// Returns `Some(t)` where `t` is the time `self - duration` if `t` can be represented as /// `SystemTime` (which means it's inside the bounds of the underlying data structure), `None` /// otherwise. - #[unstable(feature = "time_checked_add", issue = "55940")] + #[stable(feature = "time_checked_add", since = "1.34.0")] pub fn checked_sub(&self, duration: Duration) -> Option { - self.0.checked_sub_duration(&duration).map(|t| SystemTime(t)) + self.0.checked_sub_duration(&duration).map(SystemTime) } }