Change:
, anyone using the former . I guess we can't outright deprecate given our backwards compatibility policy, but I would like to lint on its usage and at the very least call it out in the documentation ("use instead"). This also opens the conversation around the larger problem of what to do with the parts of the API that would get superseded by new features, like const generics, or in this case const fns.
Can we just deprecate it?
Why is a problem?
Similarly, the initializers for the family of structs were deprecated in 1.34 and have a rustfix-able suggestion to use the function. For example, see .
"There should be only one way of doing it" I saw someone today get quite confused today as to why both existed in the first place, which required an explanation of 's backwards compatibility policy, behavior, and release schedules. I feel that we should have an aggressive funnel towards "the right way of doing things" across the board, that includes linting against usages that are only kept because of historical reasons. At the very least I'd like to see the documentation updated so that it preempts the questions I got asked today
/me Prepares plans to deprecate :) In all seriousness, imo someone's confusion as to why both existed and "only one way to do it" is a rather weak justification for churn when the old way isn't harmful in any way. Seems fine.
We deprecate things like ONCE_INIT 3 releases after their replacements (in this case Once::new specifically being a const fn) were . I can't find in the release notes when that happened, but if someone tracks it down, it should be an easy PR!
was stabilized . Didn't find any reference to it .
Was it callable as a const fn in 1.2.0?
The const-ness was made stable in the same PR as for AtomicUsize::new:

Discussion:
pub fn check_for_errors_in<T, F>(f: F) -> Result<T, String> where F: FnOnce() -> T, { <del> use std::sync::{Mutex, Once, ONCE_INIT}; static INIT: Once = ONCE_INIT; </del> <ins> use std::sync::{Mutex, Once}; static INIT: Once = Once::new(); </ins> static mut LOCK: *mut Mutex<()> = 0 as *mut _; unsafe { INIT.call_once(|| {

#[stable(feature = "rust1", since = "1.0.0")] pub use self::mutex::{Mutex, MutexGuard}; #[stable(feature = "rust1", since = "1.0.0")] <ins> #[allow(deprecated)] </ins> 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};

/// static START: Once = ONCE_INIT; /// ``` #[stable(feature = "rust1", since = "1.0.0")] <ins> #[rustc_deprecated( since = "1.38.0", reason = "the `new` function is now preferred", suggestion = "Once::new()", )] </ins> pub const ONCE_INIT: Once = Once::new(); // Four states that a Once can be in, encoded into the lower bits of `state` in

ArenaSet(vec![], &Z) } unsafe { <del> use std::sync::{Once, ONCE_INIT}; </del> <ins> use std::sync::Once; </ins> fn require_sync<T: Sync>(_: &T) { } unsafe fn __stability() -> &'static ArenaSet<Vec<u8>> { use std::mem::transmute; static mut DATA: *const ArenaSet<Vec<u8>> = 0 as *const ArenaSet<Vec<u8>>; <del> static mut ONCE: Once = ONCE_INIT; </del> <ins> static mut ONCE: Once = Once::new(); </ins> ONCE.call_once(|| { DATA = transmute ::<Box<ArenaSet<Vec<u8>>>, *const ArenaSet<Vec<u8>>>