Rollup merge of #131289 - RalfJung:duration_consts_float, r=tgross35
stabilize duration_consts_float Waiting for FCP in https://github.com/rust-lang/rust/issues/72440 to pass. `as_millis_f32` and `as_millis_f64` are not stable at all yet, so I moved their const-stability together with their regular stability (tracked at https://github.com/rust-lang/rust/issues/122451). Fixes https://github.com/rust-lang/rust/issues/72440
This commit is contained in:
commit
3e16b77465
@ -153,7 +153,6 @@
|
|||||||
#![feature(const_unicode_case_lookup)]
|
#![feature(const_unicode_case_lookup)]
|
||||||
#![feature(coverage_attribute)]
|
#![feature(coverage_attribute)]
|
||||||
#![feature(do_not_recommend)]
|
#![feature(do_not_recommend)]
|
||||||
#![feature(duration_consts_float)]
|
|
||||||
#![feature(internal_impls_macro)]
|
#![feature(internal_impls_macro)]
|
||||||
#![feature(ip)]
|
#![feature(ip)]
|
||||||
#![feature(is_ascii_octdigit)]
|
#![feature(is_ascii_octdigit)]
|
||||||
|
@ -847,7 +847,7 @@ pub const fn checked_div(self, rhs: u32) -> Option<Duration> {
|
|||||||
#[stable(feature = "duration_float", since = "1.38.0")]
|
#[stable(feature = "duration_float", since = "1.38.0")]
|
||||||
#[must_use]
|
#[must_use]
|
||||||
#[inline]
|
#[inline]
|
||||||
#[rustc_const_unstable(feature = "duration_consts_float", issue = "72440")]
|
#[rustc_const_stable(feature = "duration_consts_float", since = "CURRENT_RUSTC_VERSION")]
|
||||||
pub const fn as_secs_f64(&self) -> f64 {
|
pub const fn as_secs_f64(&self) -> f64 {
|
||||||
(self.secs as f64) + (self.nanos.0 as f64) / (NANOS_PER_SEC as f64)
|
(self.secs as f64) + (self.nanos.0 as f64) / (NANOS_PER_SEC as f64)
|
||||||
}
|
}
|
||||||
@ -866,7 +866,7 @@ pub const fn as_secs_f64(&self) -> f64 {
|
|||||||
#[stable(feature = "duration_float", since = "1.38.0")]
|
#[stable(feature = "duration_float", since = "1.38.0")]
|
||||||
#[must_use]
|
#[must_use]
|
||||||
#[inline]
|
#[inline]
|
||||||
#[rustc_const_unstable(feature = "duration_consts_float", issue = "72440")]
|
#[rustc_const_stable(feature = "duration_consts_float", since = "CURRENT_RUSTC_VERSION")]
|
||||||
pub const fn as_secs_f32(&self) -> f32 {
|
pub const fn as_secs_f32(&self) -> f32 {
|
||||||
(self.secs as f32) + (self.nanos.0 as f32) / (NANOS_PER_SEC as f32)
|
(self.secs as f32) + (self.nanos.0 as f32) / (NANOS_PER_SEC as f32)
|
||||||
}
|
}
|
||||||
@ -886,7 +886,7 @@ pub const fn as_secs_f32(&self) -> f32 {
|
|||||||
#[unstable(feature = "duration_millis_float", issue = "122451")]
|
#[unstable(feature = "duration_millis_float", issue = "122451")]
|
||||||
#[must_use]
|
#[must_use]
|
||||||
#[inline]
|
#[inline]
|
||||||
#[rustc_const_unstable(feature = "duration_consts_float", issue = "72440")]
|
#[rustc_const_unstable(feature = "duration_millis_float", issue = "122451")]
|
||||||
pub const fn as_millis_f64(&self) -> f64 {
|
pub const fn as_millis_f64(&self) -> f64 {
|
||||||
(self.secs as f64) * (MILLIS_PER_SEC as f64)
|
(self.secs as f64) * (MILLIS_PER_SEC as f64)
|
||||||
+ (self.nanos.0 as f64) / (NANOS_PER_MILLI as f64)
|
+ (self.nanos.0 as f64) / (NANOS_PER_MILLI as f64)
|
||||||
@ -907,7 +907,7 @@ pub const fn as_millis_f64(&self) -> f64 {
|
|||||||
#[unstable(feature = "duration_millis_float", issue = "122451")]
|
#[unstable(feature = "duration_millis_float", issue = "122451")]
|
||||||
#[must_use]
|
#[must_use]
|
||||||
#[inline]
|
#[inline]
|
||||||
#[rustc_const_unstable(feature = "duration_consts_float", issue = "72440")]
|
#[rustc_const_unstable(feature = "duration_millis_float", issue = "122451")]
|
||||||
pub const fn as_millis_f32(&self) -> f32 {
|
pub const fn as_millis_f32(&self) -> f32 {
|
||||||
(self.secs as f32) * (MILLIS_PER_SEC as f32)
|
(self.secs as f32) * (MILLIS_PER_SEC as f32)
|
||||||
+ (self.nanos.0 as f32) / (NANOS_PER_MILLI as f32)
|
+ (self.nanos.0 as f32) / (NANOS_PER_MILLI as f32)
|
||||||
@ -1087,7 +1087,7 @@ pub fn div_f32(self, rhs: f32) -> Duration {
|
|||||||
#[must_use = "this returns the result of the operation, \
|
#[must_use = "this returns the result of the operation, \
|
||||||
without modifying the original"]
|
without modifying the original"]
|
||||||
#[inline]
|
#[inline]
|
||||||
#[rustc_const_unstable(feature = "duration_consts_float", issue = "72440")]
|
#[rustc_const_stable(feature = "duration_consts_float", since = "CURRENT_RUSTC_VERSION")]
|
||||||
pub const fn div_duration_f64(self, rhs: Duration) -> f64 {
|
pub const fn div_duration_f64(self, rhs: Duration) -> f64 {
|
||||||
let self_nanos = (self.secs as f64) * (NANOS_PER_SEC as f64) + (self.nanos.0 as f64);
|
let self_nanos = (self.secs as f64) * (NANOS_PER_SEC as f64) + (self.nanos.0 as f64);
|
||||||
let rhs_nanos = (rhs.secs as f64) * (NANOS_PER_SEC as f64) + (rhs.nanos.0 as f64);
|
let rhs_nanos = (rhs.secs as f64) * (NANOS_PER_SEC as f64) + (rhs.nanos.0 as f64);
|
||||||
@ -1108,7 +1108,7 @@ pub const fn div_duration_f64(self, rhs: Duration) -> f64 {
|
|||||||
#[must_use = "this returns the result of the operation, \
|
#[must_use = "this returns the result of the operation, \
|
||||||
without modifying the original"]
|
without modifying the original"]
|
||||||
#[inline]
|
#[inline]
|
||||||
#[rustc_const_unstable(feature = "duration_consts_float", issue = "72440")]
|
#[rustc_const_stable(feature = "duration_consts_float", since = "CURRENT_RUSTC_VERSION")]
|
||||||
pub const fn div_duration_f32(self, rhs: Duration) -> f32 {
|
pub const fn div_duration_f32(self, rhs: Duration) -> f32 {
|
||||||
let self_nanos = (self.secs as f32) * (NANOS_PER_SEC as f32) + (self.nanos.0 as f32);
|
let self_nanos = (self.secs as f32) * (NANOS_PER_SEC as f32) + (self.nanos.0 as f32);
|
||||||
let rhs_nanos = (rhs.secs as f32) * (NANOS_PER_SEC as f32) + (rhs.nanos.0 as f32);
|
let rhs_nanos = (rhs.secs as f32) * (NANOS_PER_SEC as f32) + (rhs.nanos.0 as f32);
|
||||||
|
@ -38,7 +38,6 @@
|
|||||||
#![feature(dec2flt)]
|
#![feature(dec2flt)]
|
||||||
#![feature(duration_constants)]
|
#![feature(duration_constants)]
|
||||||
#![feature(duration_constructors)]
|
#![feature(duration_constructors)]
|
||||||
#![feature(duration_consts_float)]
|
|
||||||
#![feature(error_generic_member_access)]
|
#![feature(error_generic_member_access)]
|
||||||
#![feature(exact_size_is_empty)]
|
#![feature(exact_size_is_empty)]
|
||||||
#![feature(extern_types)]
|
#![feature(extern_types)]
|
||||||
|
Loading…
Reference in New Issue
Block a user