Skip to content

Commit b8f2674

Browse files
committed
Auto merge of #46666 - clarcharr:duration_core, r=alexcrichton
Move Duration to libcore Fixes #46520; should be merged after #46508.
2 parents def3269 + aab712c commit b8f2674

File tree

3 files changed

+16
-4
lines changed

3 files changed

+16
-4
lines changed

src/libcore/lib.rs

+1
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,7 @@ pub mod slice;
168168
pub mod str;
169169
pub mod hash;
170170
pub mod fmt;
171+
pub mod time;
171172

172173
// note: does not need to be public
173174
mod char_private;

src/libstd/time/duration.rs src/libcore/time.rs

+14-1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,19 @@
77
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
10+
#![stable(feature = "duration_core", since = "1.24.0")]
11+
12+
//! Temporal quantification.
13+
//!
14+
//! Example:
15+
//!
16+
//! ```
17+
//! use std::time::Duration;
18+
//!
19+
//! let five_seconds = Duration::new(5, 0);
20+
//! // both declarations are equivalent
21+
//! assert_eq!(Duration::new(5, 0), Duration::from_secs(5));
22+
//! ```
1023
1124
use iter::Sum;
1225
use ops::{Add, Sub, Mul, Div, AddAssign, SubAssign, MulAssign, DivAssign};
@@ -45,7 +58,7 @@ const MICROS_PER_SEC: u64 = 1_000_000;
4558
///
4659
/// let ten_millis = Duration::from_millis(10);
4760
/// ```
48-
#[stable(feature = "duration", since = "1.3.0")]
61+
#[stable(feature = "duration_core", since = "1.24.0")]
4962
#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Debug, Hash, Default)]
5063
pub struct Duration {
5164
secs: u64,

src/libstd/time/mod.rs src/libstd/time.rs

+1-3
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,7 @@ use sys::time;
2929
use sys_common::FromInner;
3030

3131
#[stable(feature = "time", since = "1.3.0")]
32-
pub use self::duration::Duration;
33-
34-
mod duration;
32+
pub use core::time::Duration;
3533

3634
/// A measurement of a monotonically nondecreasing clock.
3735
/// Opaque and useful only with `Duration`.

0 commit comments

Comments
 (0)