mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-23 23:34:48 +00:00
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:
commit
3d6a364e33
@ -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));
|
||||
|
@ -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)]
|
||||
|
@ -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)]
|
||||
|
Loading…
Reference in New Issue
Block a user