Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

std::sync::ONCE_INIT is deprecated #151

Closed
JacobEberhardt opened this issue Jul 8, 2019 · 2 comments · Fixed by #152
Closed

std::sync::ONCE_INIT is deprecated #151

JacobEberhardt opened this issue Jul 8, 2019 · 2 comments · Fixed by #152

Comments

@JacobEberhardt
Copy link

std::sync::ONCE_INIT is deprecated which leads to warnings when building.
Would be great, if this could be replaced.

Built with
rustc 1.38.0-nightly (6e310f2ab 2019-07-07)

Reproducible by building the example from readme.md.
This results in the following warning:
warning: use of deprecated item 'lazy::std::sync::ONCE_INIT': the new function is now preferred --> src/inline_lazy.rs:14:9 | 14 | pub use self::std::sync::ONCE_INIT; | ^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: #[warn(deprecated)] on by default

@BurntSushi
Copy link
Member

ONCE_INIT won't actually be deprecated for another two releases.

We should just add a targeted allow(deprecated) to its use of ONCE_INIT. There's not much point in bumping the MSRV from 1.24 to 1.31 just so Once::new can be used.

@AxelNennker
Copy link

Sorry for commenting on a closed issue...
I am wondering whether you considered using https://github.com/dtolnay/rustversion
So if the rustc version is 1.31 or newer use Once::new otherwise use ONCE_INIT
Or something.
Thanks for maintaining lazy_static

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants