Skip to content

Commit ed799c2

Browse files
committed
Split duration_constructors to get non-controversial bits out faster.
1 parent dcecb99 commit ed799c2

File tree

6 files changed

+29
-7
lines changed

6 files changed

+29
-7
lines changed

library/core/src/time.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -373,15 +373,15 @@ impl Duration {
373373
/// # Examples
374374
///
375375
/// ```
376-
/// #![feature(duration_constructors)]
376+
/// #![feature(duration_constructors_lite)]
377377
/// use std::time::Duration;
378378
///
379379
/// let duration = Duration::from_hours(6);
380380
///
381381
/// assert_eq!(6 * 60 * 60, duration.as_secs());
382382
/// assert_eq!(0, duration.subsec_nanos());
383383
/// ```
384-
#[unstable(feature = "duration_constructors", issue = "120301")]
384+
#[unstable(feature = "duration_constructors_lite", issue = "140881")]
385385
#[must_use]
386386
#[inline]
387387
pub const fn from_hours(hours: u64) -> Duration {
@@ -401,15 +401,15 @@ impl Duration {
401401
/// # Examples
402402
///
403403
/// ```
404-
/// #![feature(duration_constructors)]
404+
/// #![feature(duration_constructors_lite)]
405405
/// use std::time::Duration;
406406
///
407407
/// let duration = Duration::from_mins(10);
408408
///
409409
/// assert_eq!(10 * 60, duration.as_secs());
410410
/// assert_eq!(0, duration.subsec_nanos());
411411
/// ```
412-
#[unstable(feature = "duration_constructors", issue = "120301")]
412+
#[unstable(feature = "duration_constructors_lite", issue = "140881")]
413413
#[must_use]
414414
#[inline]
415415
pub const fn from_mins(mins: u64) -> Duration {

library/coretests/tests/lib.rs

+1
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
#![feature(dec2flt)]
2525
#![feature(duration_constants)]
2626
#![feature(duration_constructors)]
27+
#![feature(duration_constructors_lite)]
2728
#![feature(error_generic_member_access)]
2829
#![feature(exact_size_is_empty)]
2930
#![feature(extend_one)]

library/coretests/tests/time.rs

+10-1
Original file line numberDiff line numberDiff line change
@@ -46,16 +46,25 @@ fn from_weeks_overflow() {
4646
}
4747

4848
#[test]
49-
fn constructors() {
49+
fn constructor_weeks() {
5050
assert_eq!(Duration::from_weeks(1), Duration::from_secs(7 * 24 * 60 * 60));
5151
assert_eq!(Duration::from_weeks(0), Duration::ZERO);
52+
}
5253

54+
#[test]
55+
fn constructor_days() {
5356
assert_eq!(Duration::from_days(1), Duration::from_secs(86_400));
5457
assert_eq!(Duration::from_days(0), Duration::ZERO);
58+
}
5559

60+
#[test]
61+
fn constructor_hours() {
5662
assert_eq!(Duration::from_hours(1), Duration::from_secs(3_600));
5763
assert_eq!(Duration::from_hours(0), Duration::ZERO);
64+
}
5865

66+
#[test]
67+
fn constructor_minutes() {
5968
assert_eq!(Duration::from_mins(1), Duration::from_secs(60));
6069
assert_eq!(Duration::from_mins(0), Duration::ZERO);
6170
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# `duration_constructors_lite`
2+
3+
The tracking issue for this feature is: [#140881]
4+
5+
[#140881]: https://github.com/rust-lang/rust/issues/140881
6+
7+
------------------------
8+
9+
Add the methods `from_mins`, `from_hours` to `Duration`.
10+
11+
For `from_days` and `from_weeks` see [`duration_constructors`](https://github.com/rust-lang/rust/issues/120301).

src/doc/unstable-book/src/library-features/duration-constructors.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,5 @@ The tracking issue for this feature is: [#120301]
66

77
------------------------
88

9-
Add the methods `from_mins`, `from_hours` and `from_days` to `Duration`.
9+
Add the methods `from_days` and `from_weeks` to `Duration`.
10+
For `from_mins` and `from_hours` see [duration-constructors-lite.md](./duration-constructors-lite.md)

src/tools/rust-analyzer/crates/ide-db/src/generated/lints.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -5789,7 +5789,7 @@ The tracking issue for this feature is: [#120301]
57895789

57905790
------------------------
57915791

5792-
Add the methods `from_mins`, `from_hours` and `from_days` to `Duration`.
5792+
Add the methods `from_days` and `from_weeks` to `Duration`.
57935793
"##,
57945794
default_severity: Severity::Allow,
57955795
warn_since: None,

0 commit comments

Comments
 (0)