diff options
| author | Mazdak Farrokhzad <twingoow@gmail.com> | 2019-06-13 14:51:57 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2019-06-13 14:51:57 +0200 |
| commit | e45c83ca2313977850a971a4ca22610c191f1dc0 (patch) | |
| tree | d4b875f986aa29b3a20c45284fa3a08223a48e13 /src/libstd/sync | |
| parent | ca06f8896b62c58fe366bdecf2c237d8a195fd0f (diff) | |
| parent | 72e99f57c5118430361d23ed8e8815c1dd7271a5 (diff) | |
| download | rust-e45c83ca2313977850a971a4ca22610c191f1dc0.tar.gz rust-e45c83ca2313977850a971a4ca22610c191f1dc0.zip | |
Rollup merge of #61757 - sfackler:deprecate-once-init, r=alexcrichton
Deprecate ONCE_INIT in future 1.38 release Once::new() has been a stable const fn for a while now. Closes #61746
Diffstat (limited to 'src/libstd/sync')
| -rw-r--r-- | src/libstd/sync/mod.rs | 1 | ||||
| -rw-r--r-- | src/libstd/sync/once.rs | 5 |
2 files changed, 6 insertions, 0 deletions
diff --git a/src/libstd/sync/mod.rs b/src/libstd/sync/mod.rs index 809ee882698..fd6e46fd61d 100644 --- a/src/libstd/sync/mod.rs +++ b/src/libstd/sync/mod.rs @@ -163,6 +163,7 @@ pub use self::condvar::{Condvar, WaitTimeoutResult}; #[stable(feature = "rust1", since = "1.0.0")] pub use self::mutex::{Mutex, MutexGuard}; #[stable(feature = "rust1", since = "1.0.0")] +#[allow(deprecated)] pub use self::once::{Once, OnceState, ONCE_INIT}; #[stable(feature = "rust1", since = "1.0.0")] pub use crate::sys_common::poison::{PoisonError, TryLockError, TryLockResult, LockResult}; diff --git a/src/libstd/sync/once.rs b/src/libstd/sync/once.rs index 0c912494024..e529b8c4227 100644 --- a/src/libstd/sync/once.rs +++ b/src/libstd/sync/once.rs @@ -115,6 +115,11 @@ pub struct OnceState { /// static START: Once = ONCE_INIT; /// ``` #[stable(feature = "rust1", since = "1.0.0")] +#[rustc_deprecated( + since = "1.38.0", + reason = "the `new` function is now preferred", + suggestion = "Once::new()", +)] pub const ONCE_INIT: Once = Once::new(); // Four states that a Once can be in, encoded into the lower bits of `state` in |
