Rollup merge of #84084 - m-ou-se:stabilize-zero, r=scottmcm

Stabilize duration_zero.

FCP here: https://github.com/rust-lang/rust/issues/73544#issuecomment-817201305
This commit is contained in:
Dylan DPC 2021-04-13 11:10:40 +02:00 committed by GitHub
commit 3d6a364e33
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 3 additions and 7 deletions

View File

@ -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.
@ -269,7 +268,6 @@ impl Duration {
/// # Examples
///
/// ```
/// #![feature(duration_zero)]
/// use std::time::Duration;
///
/// assert!(Duration::ZERO.is_zero());
@ -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
@ -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));

View File

@ -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)]

View File

@ -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)]