about summary refs log tree commit diff
diff options
context:
space:
mode:
authorDietrich Daroch <Dietrich@Daroch.me>2025-05-09 19:53:23 -0400
committerDietrich Daroch <Dietrich@Daroch.me>2025-05-09 22:52:39 -0400
commited799c20195f182159429358e64f1ee1cecac2dc (patch)
tree1b3b140ecad822c9f6be8473b88cd2110e998d5a
parentdcecb99176edf2eec51613730937d21cdd5c8f6e (diff)
downloadrust-ed799c20195f182159429358e64f1ee1cecac2dc.tar.gz
rust-ed799c20195f182159429358e64f1ee1cecac2dc.zip
Split duration_constructors to get non-controversial bits out faster.
-rw-r--r--library/core/src/time.rs8
-rw-r--r--library/coretests/tests/lib.rs1
-rw-r--r--library/coretests/tests/time.rs11
-rw-r--r--src/doc/unstable-book/src/library-features/duration-constructors-lite.md11
-rw-r--r--src/doc/unstable-book/src/library-features/duration-constructors.md3
-rw-r--r--src/tools/rust-analyzer/crates/ide-db/src/generated/lints.rs2
6 files changed, 29 insertions, 7 deletions
diff --git a/library/core/src/time.rs b/library/core/src/time.rs
index 18c03b4a6f8..0fb5c0bac75 100644
--- a/library/core/src/time.rs
+++ b/library/core/src/time.rs
@@ -373,7 +373,7 @@ impl Duration {
     /// # Examples
     ///
     /// ```
-    /// #![feature(duration_constructors)]
+    /// #![feature(duration_constructors_lite)]
     /// use std::time::Duration;
     ///
     /// let duration = Duration::from_hours(6);
@@ -381,7 +381,7 @@ impl Duration {
     /// assert_eq!(6 * 60 * 60, duration.as_secs());
     /// assert_eq!(0, duration.subsec_nanos());
     /// ```
-    #[unstable(feature = "duration_constructors", issue = "120301")]
+    #[unstable(feature = "duration_constructors_lite", issue = "140881")]
     #[must_use]
     #[inline]
     pub const fn from_hours(hours: u64) -> Duration {
@@ -401,7 +401,7 @@ impl Duration {
     /// # Examples
     ///
     /// ```
-    /// #![feature(duration_constructors)]
+    /// #![feature(duration_constructors_lite)]
     /// use std::time::Duration;
     ///
     /// let duration = Duration::from_mins(10);
@@ -409,7 +409,7 @@ impl Duration {
     /// assert_eq!(10 * 60, duration.as_secs());
     /// assert_eq!(0, duration.subsec_nanos());
     /// ```
-    #[unstable(feature = "duration_constructors", issue = "120301")]
+    #[unstable(feature = "duration_constructors_lite", issue = "140881")]
     #[must_use]
     #[inline]
     pub const fn from_mins(mins: u64) -> Duration {
diff --git a/library/coretests/tests/lib.rs b/library/coretests/tests/lib.rs
index a71c4139308..0575375cf4f 100644
--- a/library/coretests/tests/lib.rs
+++ b/library/coretests/tests/lib.rs
@@ -24,6 +24,7 @@
 #![feature(dec2flt)]
 #![feature(duration_constants)]
 #![feature(duration_constructors)]
+#![feature(duration_constructors_lite)]
 #![feature(error_generic_member_access)]
 #![feature(exact_size_is_empty)]
 #![feature(extend_one)]
diff --git a/library/coretests/tests/time.rs b/library/coretests/tests/time.rs
index fe7bb11c675..bb98e59bf5a 100644
--- a/library/coretests/tests/time.rs
+++ b/library/coretests/tests/time.rs
@@ -46,16 +46,25 @@ fn from_weeks_overflow() {
 }
 
 #[test]
-fn constructors() {
+fn constructor_weeks() {
     assert_eq!(Duration::from_weeks(1), Duration::from_secs(7 * 24 * 60 * 60));
     assert_eq!(Duration::from_weeks(0), Duration::ZERO);
+}
 
+#[test]
+fn constructor_days() {
     assert_eq!(Duration::from_days(1), Duration::from_secs(86_400));
     assert_eq!(Duration::from_days(0), Duration::ZERO);
+}
 
+#[test]
+fn constructor_hours() {
     assert_eq!(Duration::from_hours(1), Duration::from_secs(3_600));
     assert_eq!(Duration::from_hours(0), Duration::ZERO);
+}
 
+#[test]
+fn constructor_minutes() {
     assert_eq!(Duration::from_mins(1), Duration::from_secs(60));
     assert_eq!(Duration::from_mins(0), Duration::ZERO);
 }
diff --git a/src/doc/unstable-book/src/library-features/duration-constructors-lite.md b/src/doc/unstable-book/src/library-features/duration-constructors-lite.md
new file mode 100644
index 00000000000..5238b84f776
--- /dev/null
+++ b/src/doc/unstable-book/src/library-features/duration-constructors-lite.md
@@ -0,0 +1,11 @@
+# `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).
diff --git a/src/doc/unstable-book/src/library-features/duration-constructors.md b/src/doc/unstable-book/src/library-features/duration-constructors.md
index 098519c7c90..49ad78d1961 100644
--- a/src/doc/unstable-book/src/library-features/duration-constructors.md
+++ b/src/doc/unstable-book/src/library-features/duration-constructors.md
@@ -6,4 +6,5 @@ The tracking issue for this feature is: [#120301]
 
 ------------------------
 
-Add the methods `from_mins`, `from_hours` and `from_days` to `Duration`.
+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)
diff --git a/src/tools/rust-analyzer/crates/ide-db/src/generated/lints.rs b/src/tools/rust-analyzer/crates/ide-db/src/generated/lints.rs
index 706d04484f6..f9ff3921266 100644
--- a/src/tools/rust-analyzer/crates/ide-db/src/generated/lints.rs
+++ b/src/tools/rust-analyzer/crates/ide-db/src/generated/lints.rs
@@ -5789,7 +5789,7 @@ The tracking issue for this feature is: [#120301]
 
 ------------------------
 
-Add the methods `from_mins`, `from_hours` and `from_days` to `Duration`.
+Add the methods `from_days` and `from_weeks` to `Duration`.
 "##,
         default_severity: Severity::Allow,
         warn_since: None,