Change:
<!-- Thank you for creating a tracking issue! Tracking issues are for tracking a feature from implementation to stabilisation. Make sure to include the relevant RFC for the feature if it has one. Otherwise provide a short summary of the feature and link any relevant PRs or issues, and remove any sections that are not relevant to the feature. Remember to add team labels to the tracking issue. For a language team feature, this would e.g., be . Such a feature should also be labeled with e.g., . This label is used to associate issues (e.g., bugs and design questions) to the feature. --This is a tracking issue for constify-ing non-trait methods The feature gates for the issueis . The methods covered by that are: <!-- Include each step required to complete the feature. Typically this is a PR implementing a feature, followed by a PR that stabilises the feature. However for larger features an implementation could be broken up into multiple PRs. --- [ ] Adjust documentation ([see instructions on rustc-dev-guide][doc-guide]) [ ] Stabilization PR ([see instructions on rustc-dev-guide][stabilization-guide]) [stabilization-guide]: https://rustc-dev- [doc-guide]: https://rustc-dev- <!-- Include any open questions that need to be answered before the feature can be stabilised. --XXX --- list all the "unresolved questions" found in the RFC to ensure they are not forgotten <!-- Include a list of all the PRs that were involved in implementing the feature. --- [x] Constify most non-trait methods as described: [x] Make all methods of Duration unstably const: [x] Partially stabilize durationconsts_2:
I also would like to add a associated const. Should it be part of the same tracking issue?
I don't think so -- adding a new constant seems pretty orthogonal to me.
It's orthogonal but depends on being const so I thought having a tracking issue just for one associated const might be overkill.
FWIW, makes the other safe wrappers const. Once that lands, and could also be made const.
All right, will make const as well, so you should be able to use that.
Great! I'll wait for to land and update my PR accordingly.
The tracking issue should also notice that stabilizing any of the / methods is blocked on stabilizing floating point in const at all ().
PR stabilizing non-float methods is up:
Didn't see this mentioned anywhere with a quick search, but is not anymore? Is no-op now?
Looking at this closer today, the and float functions were no longer after . That's because the makes use of , the trait impls of which are no longer . The calls can be replaced with if it is desired to restore the impls.
With being stable now, I think we can proceed with stabilizing these as well? :) EDIT: I updated the function list; some things listed there were actually not even unstably const any more.
fcp merge for these 6 already-stable Duration methods, unblocked by in Rust 1.82 (current beta).
Team member has proposed to merge this. The next step is review by the rest of the tagged team members: [x] [x] [x] [ ] [ ] No concerns currently listed. Once a majority of reviewers approve (and at most 2 approvals are outstanding), this will enter its final comment period. If you spot a major issue that hasn't been raised at any point in this process, please speak up! See for info about what commands tagged team members can give me.
:bell: This is now entering its final comment period, as per the . :bell:
The final comment period, with a disposition to merge, as per the , is now complete. As the automated representative of the governance process, I would like to thank the author for their work and everyone else who contributed. This will be merged soon.

Discussion:
#![feature(const_unicode_case_lookup)] #![feature(coverage_attribute)] #![feature(do_not_recommend)] <del> #![feature(duration_consts_float)] </del> #![feature(internal_impls_macro)] #![feature(ip)] #![feature(is_ascii_octdigit)]

#[stable(feature = "duration_float", since = "1.38.0")] #[must_use] #[inline] <del> #[rustc_const_unstable(feature = "duration_consts_float", issue = "72440")] </del> <ins> #[rustc_const_stable(feature = "duration_consts_float", since = "CURRENT_RUSTC_VERSION")] </ins> pub const fn as_secs_f64(&self) -> f64 { (self.secs as f64) + (self.nanos.0 as f64) / (NANOS_PER_SEC as f64) }

#[stable(feature = "duration_float", since = "1.38.0")] #[must_use] #[inline] <del> #[rustc_const_unstable(feature = "duration_consts_float", issue = "72440")] </del> <ins> #[rustc_const_stable(feature = "duration_consts_float", since = "CURRENT_RUSTC_VERSION")] </ins> pub const fn as_secs_f32(&self) -> f32 { (self.secs as f32) + (self.nanos.0 as f32) / (NANOS_PER_SEC as f32) }

#[unstable(feature = "duration_millis_float", issue = "122451")] #[must_use] #[inline] <del> #[rustc_const_unstable(feature = "duration_consts_float", issue = "72440")] </del> <ins> #[rustc_const_unstable(feature = "duration_millis_float", issue = "122451")] </ins> 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)

#[unstable(feature = "duration_millis_float", issue = "122451")] #[must_use] #[inline] <del> #[rustc_const_unstable(feature = "duration_consts_float", issue = "72440")] </del> <ins> #[rustc_const_unstable(feature = "duration_millis_float", issue = "122451")] </ins> 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)

#[must_use = "this returns the result of the operation,  without modifying the original"] #[inline] <del> #[rustc_const_unstable(feature = "duration_consts_float", issue = "72440")] </del> <ins> #[rustc_const_stable(feature = "duration_consts_float", since = "CURRENT_RUSTC_VERSION")] </ins> 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);

#[must_use = "this returns the result of the operation,  without modifying the original"] #[inline] <del> #[rustc_const_unstable(feature = "duration_consts_float", issue = "72440")] </del> <ins> #[rustc_const_stable(feature = "duration_consts_float", since = "CURRENT_RUSTC_VERSION")] </ins> 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);

#![feature(dec2flt)] #![feature(duration_constants)] #![feature(duration_constructors)] <del> #![feature(duration_consts_float)] </del> #![feature(error_generic_member_access)] #![feature(exact_size_is_empty)] #![feature(extern_types)]