about summary refs log tree commit diff
path: root/src/libstd/sync
diff options
context:
space:
mode:
authorSteven Fackler <sfackler@gmail.com>2019-06-11 18:57:48 -0700
committerSteven Fackler <sfackler@gmail.com>2019-06-12 21:32:51 -0700
commit72e99f57c5118430361d23ed8e8815c1dd7271a5 (patch)
tree0682ccd73686fb8b24aad5ce2d6ba44d23227fa0 /src/libstd/sync
parent5f3656ce9a2212fad872605b7a4ee103a155e9f3 (diff)
downloadrust-72e99f57c5118430361d23ed8e8815c1dd7271a5.tar.gz
rust-72e99f57c5118430361d23ed8e8815c1dd7271a5.zip
Deprecate ONCE_INIT
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.rs1
-rw-r--r--src/libstd/sync/once.rs5
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