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

lazy_static without unsafe? #125

Closed
matthiasbeyer opened this issue Sep 27, 2018 · 2 comments
Closed

lazy_static without unsafe? #125

matthiasbeyer opened this issue Sep 27, 2018 · 2 comments

Comments

@matthiasbeyer
Copy link

Hi,

I'm trying to use #![forbid(unsafe_code)] but I also want to use lazy_static!() - is there a way?

My failling travis job is here

@KodrAus
Copy link
Contributor

KodrAus commented Oct 30, 2018

Hmm, the problem here is that the macro-generated deref impl for lazy statics uses an unsafe block because it accesses a 'static mut. In #124 we're removing the need for 'static mut, so we should be able to work properly with crates that #![forbid(unsafe_code)].

@KodrAus
Copy link
Contributor

KodrAus commented Nov 4, 2018

Alrighty! It should be possible now to use lazy_static 1.2.0 alongside #![forbid(unsafe_code)].

@KodrAus KodrAus closed this as completed Nov 4, 2018
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

No branches or pull requests

2 participants