Skip to content

Commit ee437eb

Browse files
authoredSep 5, 2019
Rollup merge of rust-lang#62860 - vi:stabilize_checked_duration_since, r=Mark-Simulacrum
Stabilize checked_duration_since for 1.38.0 Looks like it has already found some use in projects. Resolves rust-lang#58402.
2 parents f257c40 + 5545582 commit ee437eb

File tree

3 files changed

+4
-7
lines changed

3 files changed

+4
-7
lines changed
 

‎src/libstd/lib.rs

-1
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,6 @@
244244
#![feature(cfg_target_has_atomic)]
245245
#![feature(cfg_target_thread_local)]
246246
#![feature(char_error_internals)]
247-
#![feature(checked_duration_since)]
248247
#![feature(clamp)]
249248
#![feature(compiler_builtins_lib)]
250249
#![feature(concat_idents)]

‎src/libstd/time.rs

+2-4
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,6 @@ impl Instant {
221221
/// # Examples
222222
///
223223
/// ```no_run
224-
/// #![feature(checked_duration_since)]
225224
/// use std::time::{Duration, Instant};
226225
/// use std::thread::sleep;
227226
///
@@ -231,7 +230,7 @@ impl Instant {
231230
/// println!("{:?}", new_now.checked_duration_since(now));
232231
/// println!("{:?}", now.checked_duration_since(new_now)); // None
233232
/// ```
234-
#[unstable(feature = "checked_duration_since", issue = "58402")]
233+
#[stable(feature = "checked_duration_since", since = "1.39.0")]
235234
pub fn checked_duration_since(&self, earlier: Instant) -> Option<Duration> {
236235
self.0.checked_sub_instant(&earlier.0)
237236
}
@@ -242,7 +241,6 @@ impl Instant {
242241
/// # Examples
243242
///
244243
/// ```no_run
245-
/// #![feature(checked_duration_since)]
246244
/// use std::time::{Duration, Instant};
247245
/// use std::thread::sleep;
248246
///
@@ -252,7 +250,7 @@ impl Instant {
252250
/// println!("{:?}", new_now.saturating_duration_since(now));
253251
/// println!("{:?}", now.saturating_duration_since(new_now)); // 0ns
254252
/// ```
255-
#[unstable(feature = "checked_duration_since", issue = "58402")]
253+
#[stable(feature = "checked_duration_since", since = "1.39.0")]
256254
pub fn saturating_duration_since(&self, earlier: Instant) -> Duration {
257255
self.checked_duration_since(earlier).unwrap_or(Duration::new(0, 0))
258256
}

‎src/tools/tidy/src/features/tests.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ use super::*;
22

33
#[test]
44
fn test_find_attr_val() {
5-
let s = r#"#[unstable(feature = "checked_duration_since", issue = "58402")]"#;
6-
assert_eq!(find_attr_val(s, "feature"), Some("checked_duration_since"));
5+
let s = r#"#[unstable(feature = "tidy_test_never_used_anywhere_else", issue = "58402")]"#;
6+
assert_eq!(find_attr_val(s, "feature"), Some("tidy_test_never_used_anywhere_else"));
77
assert_eq!(find_attr_val(s, "issue"), Some("58402"));
88
assert_eq!(find_attr_val(s, "since"), None);
99
}

0 commit comments

Comments
 (0)