Skip to content

Commit 0ab1057

Browse files
authored
Rollup merge of rust-lang#58034 - faern:stabilize-time-checked-add, r=alexcrichton
Stabilize the time_checked_add feature Closes rust-lang#55940 Stabilizes `checked_add` and `checked_sub` on `Instant` and `SystemTime`.
2 parents 0ed894a + 2f2d495 commit 0ab1057

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

src/libstd/time.rs

+8-8
Original file line numberDiff line numberDiff line change
@@ -245,17 +245,17 @@ impl Instant {
245245
/// Returns `Some(t)` where `t` is the time `self + duration` if `t` can be represented as
246246
/// `Instant` (which means it's inside the bounds of the underlying data structure), `None`
247247
/// otherwise.
248-
#[unstable(feature = "time_checked_add", issue = "55940")]
248+
#[stable(feature = "time_checked_add", since = "1.34.0")]
249249
pub fn checked_add(&self, duration: Duration) -> Option<Instant> {
250-
self.0.checked_add_duration(&duration).map(|t| Instant(t))
250+
self.0.checked_add_duration(&duration).map(Instant)
251251
}
252252

253253
/// Returns `Some(t)` where `t` is the time `self - duration` if `t` can be represented as
254254
/// `Instant` (which means it's inside the bounds of the underlying data structure), `None`
255255
/// otherwise.
256-
#[unstable(feature = "time_checked_add", issue = "55940")]
256+
#[stable(feature = "time_checked_add", since = "1.34.0")]
257257
pub fn checked_sub(&self, duration: Duration) -> Option<Instant> {
258-
self.0.checked_sub_duration(&duration).map(|t| Instant(t))
258+
self.0.checked_sub_duration(&duration).map(Instant)
259259
}
260260
}
261261

@@ -418,17 +418,17 @@ impl SystemTime {
418418
/// Returns `Some(t)` where `t` is the time `self + duration` if `t` can be represented as
419419
/// `SystemTime` (which means it's inside the bounds of the underlying data structure), `None`
420420
/// otherwise.
421-
#[unstable(feature = "time_checked_add", issue = "55940")]
421+
#[stable(feature = "time_checked_add", since = "1.34.0")]
422422
pub fn checked_add(&self, duration: Duration) -> Option<SystemTime> {
423-
self.0.checked_add_duration(&duration).map(|t| SystemTime(t))
423+
self.0.checked_add_duration(&duration).map(SystemTime)
424424
}
425425

426426
/// Returns `Some(t)` where `t` is the time `self - duration` if `t` can be represented as
427427
/// `SystemTime` (which means it's inside the bounds of the underlying data structure), `None`
428428
/// otherwise.
429-
#[unstable(feature = "time_checked_add", issue = "55940")]
429+
#[stable(feature = "time_checked_add", since = "1.34.0")]
430430
pub fn checked_sub(&self, duration: Duration) -> Option<SystemTime> {
431-
self.0.checked_sub_duration(&duration).map(|t| SystemTime(t))
431+
self.0.checked_sub_duration(&duration).map(SystemTime)
432432
}
433433
}
434434

0 commit comments

Comments
 (0)