Skip to content

Commit

Permalink
stabilize duration_consts_float
Browse files Browse the repository at this point in the history
  • Loading branch information
RalfJung committed Oct 11, 2024
1 parent 9ca739e commit 12b8028
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 8 deletions.
1 change: 0 additions & 1 deletion core/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,6 @@
#![feature(const_unicode_case_lookup)]
#![feature(coverage_attribute)]
#![feature(do_not_recommend)]
#![feature(duration_consts_float)]
#![feature(internal_impls_macro)]
#![feature(ip)]
#![feature(is_ascii_octdigit)]
Expand Down
12 changes: 6 additions & 6 deletions core/src/time.rs
Original file line number Diff line number Diff line change
Expand Up @@ -847,7 +847,7 @@ impl Duration {
#[stable(feature = "duration_float", since = "1.38.0")]
#[must_use]
#[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 {
(self.secs as f64) + (self.nanos.0 as f64) / (NANOS_PER_SEC as f64)
}
Expand All @@ -866,7 +866,7 @@ impl Duration {
#[stable(feature = "duration_float", since = "1.38.0")]
#[must_use]
#[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 {
(self.secs as f32) + (self.nanos.0 as f32) / (NANOS_PER_SEC as f32)
}
Expand All @@ -886,7 +886,7 @@ impl Duration {
#[unstable(feature = "duration_millis_float", issue = "122451")]
#[must_use]
#[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 {
(self.secs as f64) * (MILLIS_PER_SEC as f64)
+ (self.nanos.0 as f64) / (NANOS_PER_MILLI as f64)
Expand All @@ -907,7 +907,7 @@ impl Duration {
#[unstable(feature = "duration_millis_float", issue = "122451")]
#[must_use]
#[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 {
(self.secs as f32) * (MILLIS_PER_SEC as f32)
+ (self.nanos.0 as f32) / (NANOS_PER_MILLI as f32)
Expand Down Expand Up @@ -1087,7 +1087,7 @@ impl Duration {
#[must_use = "this returns the result of the operation, \
without modifying the original"]
#[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 {
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);
Expand All @@ -1108,7 +1108,7 @@ impl Duration {
#[must_use = "this returns the result of the operation, \
without modifying the original"]
#[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 {
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);
Expand Down
1 change: 0 additions & 1 deletion core/tests/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@
#![feature(dec2flt)]
#![feature(duration_constants)]
#![feature(duration_constructors)]
#![feature(duration_consts_float)]
#![feature(error_generic_member_access)]
#![feature(exact_size_is_empty)]
#![feature(extern_types)]
Expand Down

0 comments on commit 12b8028

Please sign in to comment.