Rollup merge of #145135 - Kivooeo:stabilize-duration_constructors_lite, r=ChrisDenton

Stabilize `duration_constructors_lite` feature

This closes [tracking issue](https://github.com/rust-lang/rust/issues/140881) and stabilises `Duration::from_hours` and `Duration::from_mins` while not touching a `duration_constructors` feature from the related [tracking issue (2)](https://github.com/rust-lang/rust/issues/120301)
This commit is contained in:
Stuart Cook 2025-08-10 19:45:51 +10:00 committed by GitHub
commit c15c2f0a42
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 4 additions and 17 deletions

View file

@ -373,7 +373,6 @@ impl Duration {
/// # Examples
///
/// ```
/// #![feature(duration_constructors_lite)]
/// use std::time::Duration;
///
/// let duration = Duration::from_hours(6);
@ -381,7 +380,8 @@ impl Duration {
/// assert_eq!(6 * 60 * 60, duration.as_secs());
/// assert_eq!(0, duration.subsec_nanos());
/// ```
#[unstable(feature = "duration_constructors_lite", issue = "140881")]
#[stable(feature = "duration_constructors_lite", since = "CURRENT_RUSTC_VERSION")]
#[rustc_const_stable(feature = "duration_constructors_lite", since = "CURRENT_RUSTC_VERSION")]
#[must_use]
#[inline]
pub const fn from_hours(hours: u64) -> Duration {
@ -401,7 +401,6 @@ impl Duration {
/// # Examples
///
/// ```
/// #![feature(duration_constructors_lite)]
/// use std::time::Duration;
///
/// let duration = Duration::from_mins(10);
@ -409,7 +408,8 @@ impl Duration {
/// assert_eq!(10 * 60, duration.as_secs());
/// assert_eq!(0, duration.subsec_nanos());
/// ```
#[unstable(feature = "duration_constructors_lite", issue = "140881")]
#[stable(feature = "duration_constructors_lite", since = "CURRENT_RUSTC_VERSION")]
#[rustc_const_stable(feature = "duration_constructors_lite", since = "CURRENT_RUSTC_VERSION")]
#[must_use]
#[inline]
pub const fn from_mins(mins: u64) -> Duration {

View file

@ -36,7 +36,6 @@
#![feature(drop_guard)]
#![feature(duration_constants)]
#![feature(duration_constructors)]
#![feature(duration_constructors_lite)]
#![feature(error_generic_member_access)]
#![feature(exact_div)]
#![feature(exact_size_is_empty)]

View file

@ -1,11 +0,0 @@
# `duration_constructors_lite`
The tracking issue for this feature is: [#140881]
[#140881]: https://github.com/rust-lang/rust/issues/140881
------------------------
Add the methods `from_mins`, `from_hours` to `Duration`.
For `from_days` and `from_weeks` see [`duration_constructors`](https://github.com/rust-lang/rust/issues/120301).

View file

@ -7,4 +7,3 @@ The tracking issue for this feature is: [#120301]
------------------------
Add the methods `from_days` and `from_weeks` to `Duration`.
For `from_mins` and `from_hours` see [duration-constructors-lite.md](./duration-constructors-lite.md)