Skip to content

Commit

Permalink
Rollup merge of rust-lang#84090 - marmeladema:stabilize-duration-satu…
Browse files Browse the repository at this point in the history
…rating-ops, r=m-ou-se

Stabilize feature `duration_saturating_ops`

FCP here: rust-lang#76416 (comment)

Closes rust-lang#76416

r? `@m-ou-se`
  • Loading branch information
Dylan-DPC authored Apr 11, 2021
2 parents 065d843 + 7d89148 commit e26c936
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 8 deletions.
1 change: 0 additions & 1 deletion library/core/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,6 @@
#![cfg_attr(bootstrap, feature(doc_spotlight))]
#![cfg_attr(not(bootstrap), feature(doc_notable_trait))]
#![feature(duration_consts_2)]
#![feature(duration_saturating_ops)]
#![feature(extended_key_value_attributes)]
#![feature(extern_types)]
#![feature(fundamental)]
Expand Down
9 changes: 3 additions & 6 deletions library/core/src/time.rs
Original file line number Diff line number Diff line change
Expand Up @@ -479,14 +479,13 @@ impl Duration {
/// # Examples
///
/// ```
/// #![feature(duration_saturating_ops)]
/// #![feature(duration_constants)]
/// use std::time::Duration;
///
/// assert_eq!(Duration::new(0, 0).saturating_add(Duration::new(0, 1)), Duration::new(0, 1));
/// assert_eq!(Duration::new(1, 0).saturating_add(Duration::new(u64::MAX, 0)), Duration::MAX);
/// ```
#[unstable(feature = "duration_saturating_ops", issue = "76416")]
#[stable(feature = "duration_saturating_ops", since = "1.53.0")]
#[inline]
#[rustc_const_unstable(feature = "duration_consts_2", issue = "72440")]
pub const fn saturating_add(self, rhs: Duration) -> Duration {
Expand Down Expand Up @@ -537,14 +536,13 @@ impl Duration {
/// # Examples
///
/// ```
/// #![feature(duration_saturating_ops)]
/// #![feature(duration_zero)]
/// use std::time::Duration;
///
/// assert_eq!(Duration::new(0, 1).saturating_sub(Duration::new(0, 0)), Duration::new(0, 1));
/// assert_eq!(Duration::new(0, 0).saturating_sub(Duration::new(0, 1)), Duration::ZERO);
/// ```
#[unstable(feature = "duration_saturating_ops", issue = "76416")]
#[stable(feature = "duration_saturating_ops", since = "1.53.0")]
#[inline]
#[rustc_const_unstable(feature = "duration_consts_2", issue = "72440")]
pub const fn saturating_sub(self, rhs: Duration) -> Duration {
Expand Down Expand Up @@ -590,14 +588,13 @@ impl Duration {
/// # Examples
///
/// ```
/// #![feature(duration_saturating_ops)]
/// #![feature(duration_constants)]
/// use std::time::Duration;
///
/// assert_eq!(Duration::new(0, 500_000_001).saturating_mul(2), Duration::new(1, 2));
/// assert_eq!(Duration::new(u64::MAX - 1, 0).saturating_mul(2), Duration::MAX);
/// ```
#[unstable(feature = "duration_saturating_ops", issue = "76416")]
#[stable(feature = "duration_saturating_ops", since = "1.53.0")]
#[inline]
#[rustc_const_unstable(feature = "duration_consts_2", issue = "72440")]
pub const fn saturating_mul(self, rhs: u32) -> Duration {
Expand Down
1 change: 0 additions & 1 deletion library/core/tests/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
#![feature(div_duration)]
#![feature(duration_consts_2)]
#![feature(duration_constants)]
#![feature(duration_saturating_ops)]
#![feature(duration_zero)]
#![feature(exact_size_is_empty)]
#![feature(extern_types)]
Expand Down

0 comments on commit e26c936

Please sign in to comment.