diff options
| author | Mazdak Farrokhzad <twingoow@gmail.com> | 2019-09-05 03:59:33 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2019-09-05 03:59:33 +0200 |
| commit | ee437eb5d45a757f9cfd156de1c1db988c60650a (patch) | |
| tree | 947f0642a74cc358a813ba59b99acd38ad9bd865 | |
| parent | f257c40b199198eacc65bb31f932ee04305e6d41 (diff) | |
| parent | 5545582a6f6111872cdda54d18f43a7da24661f4 (diff) | |
| download | rust-ee437eb5d45a757f9cfd156de1c1db988c60650a.tar.gz rust-ee437eb5d45a757f9cfd156de1c1db988c60650a.zip | |
Rollup merge of #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 #58402.
| -rw-r--r-- | src/libstd/lib.rs | 1 | ||||
| -rw-r--r-- | src/libstd/time.rs | 6 | ||||
| -rw-r--r-- | src/tools/tidy/src/features/tests.rs | 4 |
3 files changed, 4 insertions, 7 deletions
diff --git a/src/libstd/lib.rs b/src/libstd/lib.rs index c3882bacf87..71050b0dcd1 100644 --- a/src/libstd/lib.rs +++ b/src/libstd/lib.rs @@ -244,7 +244,6 @@ #![feature(cfg_target_has_atomic)] #![feature(cfg_target_thread_local)] #![feature(char_error_internals)] -#![feature(checked_duration_since)] #![feature(clamp)] #![feature(compiler_builtins_lib)] #![feature(concat_idents)] diff --git a/src/libstd/time.rs b/src/libstd/time.rs index 98371b9ba3d..d59085cd44a 100644 --- a/src/libstd/time.rs +++ b/src/libstd/time.rs @@ -221,7 +221,6 @@ impl Instant { /// # Examples /// /// ```no_run - /// #![feature(checked_duration_since)] /// use std::time::{Duration, Instant}; /// use std::thread::sleep; /// @@ -231,7 +230,7 @@ impl Instant { /// println!("{:?}", new_now.checked_duration_since(now)); /// println!("{:?}", now.checked_duration_since(new_now)); // None /// ``` - #[unstable(feature = "checked_duration_since", issue = "58402")] + #[stable(feature = "checked_duration_since", since = "1.39.0")] pub fn checked_duration_since(&self, earlier: Instant) -> Option<Duration> { self.0.checked_sub_instant(&earlier.0) } @@ -242,7 +241,6 @@ impl Instant { /// # Examples /// /// ```no_run - /// #![feature(checked_duration_since)] /// use std::time::{Duration, Instant}; /// use std::thread::sleep; /// @@ -252,7 +250,7 @@ impl Instant { /// println!("{:?}", new_now.saturating_duration_since(now)); /// println!("{:?}", now.saturating_duration_since(new_now)); // 0ns /// ``` - #[unstable(feature = "checked_duration_since", issue = "58402")] + #[stable(feature = "checked_duration_since", since = "1.39.0")] pub fn saturating_duration_since(&self, earlier: Instant) -> Duration { self.checked_duration_since(earlier).unwrap_or(Duration::new(0, 0)) } diff --git a/src/tools/tidy/src/features/tests.rs b/src/tools/tidy/src/features/tests.rs index fa7a931ec86..994523ac1ab 100644 --- a/src/tools/tidy/src/features/tests.rs +++ b/src/tools/tidy/src/features/tests.rs @@ -2,8 +2,8 @@ use super::*; #[test] fn test_find_attr_val() { - let s = r#"#[unstable(feature = "checked_duration_since", issue = "58402")]"#; - assert_eq!(find_attr_val(s, "feature"), Some("checked_duration_since")); + let s = r#"#[unstable(feature = "tidy_test_never_used_anywhere_else", issue = "58402")]"#; + assert_eq!(find_attr_val(s, "feature"), Some("tidy_test_never_used_anywhere_else")); assert_eq!(find_attr_val(s, "issue"), Some("58402")); assert_eq!(find_attr_val(s, "since"), None); } |
