From d1e23b8af8615a0b0bbb22f11674b977d2ecdd54 Mon Sep 17 00:00:00 2001 From: Mara Bos Date: Sun, 11 Apr 2021 11:24:17 +0200 Subject: [PATCH 1/2] Stabilize duration_zero. --- library/core/src/time.rs | 7 ++----- library/core/tests/lib.rs | 1 - library/std/src/lib.rs | 1 - 3 files changed, 2 insertions(+), 7 deletions(-) diff --git a/library/core/src/time.rs b/library/core/src/time.rs index 2219353b055ad..f6d480ae54b38 100644 --- a/library/core/src/time.rs +++ b/library/core/src/time.rs @@ -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,7 @@ 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")] #[inline] pub const fn is_zero(&self) -> bool { self.secs == 0 && self.nanos == 0 @@ -536,7 +534,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)); diff --git a/library/core/tests/lib.rs b/library/core/tests/lib.rs index 3e5e5f32609db..4b52cc5aec155 100644 --- a/library/core/tests/lib.rs +++ b/library/core/tests/lib.rs @@ -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)] diff --git a/library/std/src/lib.rs b/library/std/src/lib.rs index 91695ced6a962..d532bc076e0a8 100644 --- a/library/std/src/lib.rs +++ b/library/std/src/lib.rs @@ -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)] From b44ae964e2086b280a250dea62abad29164eea58 Mon Sep 17 00:00:00 2001 From: Mara Bos Date: Sun, 11 Apr 2021 11:36:35 +0200 Subject: [PATCH 2/2] Mark Duration::is_zero as rustc_const_stable. --- library/core/src/time.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/library/core/src/time.rs b/library/core/src/time.rs index f6d480ae54b38..fa6a6c2cccc01 100644 --- a/library/core/src/time.rs +++ b/library/core/src/time.rs @@ -280,6 +280,7 @@ impl Duration { /// assert!(!Duration::from_secs(1).is_zero()); /// ``` #[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