Skip to content

Commit

Permalink
Rollup merge of rust-lang#84084 - m-ou-se:stabilize-zero, r=scottmcm
Browse files Browse the repository at this point in the history
Stabilize duration_zero.

FCP here: rust-lang#73544 (comment)
  • Loading branch information
Dylan-DPC authored Apr 12, 2021
2 parents 22c3338 + b44ae96 commit d2529c8
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 7 deletions.
8 changes: 3 additions & 5 deletions library/core/src/time.rs
Original file line number Diff line number Diff line change
Expand Up @@ -124,14 +124,13 @@ impl Duration {
/// # Examples
///
/// ```
/// #![feature(duration_zero)]
/// use std::time::Duration;
///
/// let duration = Duration::ZERO;
/// assert!(duration.is_zero());
/// assert_eq!(duration.as_nanos(), 0);
/// ```
#[unstable(feature = "duration_zero", issue = "73544")]
#[stable(feature = "duration_zero", since = "1.53.0")]
pub const ZERO: Duration = Duration::from_nanos(0);

/// The maximum duration.
Expand Down Expand Up @@ -269,7 +268,6 @@ impl Duration {
/// # Examples
///
/// ```
/// #![feature(duration_zero)]
/// use std::time::Duration;
///
/// assert!(Duration::ZERO.is_zero());
Expand All @@ -281,7 +279,8 @@ impl Duration {
/// assert!(!Duration::from_nanos(1).is_zero());
/// assert!(!Duration::from_secs(1).is_zero());
/// ```
#[unstable(feature = "duration_zero", issue = "73544")]
#[stable(feature = "duration_zero", since = "1.53.0")]
#[rustc_const_stable(feature = "duration_zero", since = "1.53.0")]
#[inline]
pub const fn is_zero(&self) -> bool {
self.secs == 0 && self.nanos == 0
Expand Down Expand Up @@ -536,7 +535,6 @@ impl Duration {
/// # Examples
///
/// ```
/// #![feature(duration_zero)]
/// use std::time::Duration;
///
/// assert_eq!(Duration::new(0, 1).saturating_sub(Duration::new(0, 0)), Duration::new(0, 1));
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_zero)]
#![feature(exact_size_is_empty)]
#![feature(extern_types)]
#![feature(flt2dec)]
Expand Down
1 change: 0 additions & 1 deletion library/std/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,6 @@
#![cfg_attr(not(bootstrap), feature(doc_notable_trait))]
#![feature(dropck_eyepatch)]
#![feature(duration_constants)]
#![feature(duration_zero)]
#![feature(edition_panic)]
#![feature(exact_size_is_empty)]
#![feature(exhaustive_patterns)]
Expand Down

0 comments on commit d2529c8

Please sign in to comment.