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

Stabilizing statically intialized UnsafeCell? #25634

Closed
aldanor opened this issue May 20, 2015 · 3 comments
Closed

Stabilizing statically intialized UnsafeCell? #25634

aldanor opened this issue May 20, 2015 · 3 comments

Comments

@aldanor
Copy link

aldanor commented May 20, 2015

Seeing as the cell types have been somewhat recently stabilized, is static cell initialization supposed to be stabilized too at some point?

pub const FOO: Foo = Foo {
    counter: UnsafeCell { value: 0 },
};

currently triggers "error: use of unstable library feature 'core'" lint, however there's really no other way to work around this as far as I know.

@alexcrichton
Copy link
Member

Thanks for the report! Currently we're probably not going to have an issue-per-feature to stabilize, and we plan to stabilize this once const fn lands (allowing UnsafeCell::new). I'm going to close this in favor of that as once that feature is stabilized this should "just work"!

@aldanor
Copy link
Author

aldanor commented May 20, 2015

@alexcrichton Thanks for the quick answer! I must have missed that there's an open PR for the const-fn RFC now... this will be extremely useful. However, it will still be feature-gated for a good while if/when it lands, is that right?

@alexcrichton
Copy link
Member

Yeah it will be feature gated for awhile (perhaps slated for 1.2 or 1.3?).

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