Skip to content

'unsafe const fn' support #1207

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

Closed
thepowersgang opened this issue Jul 12, 2015 · 4 comments
Closed

'unsafe const fn' support #1207

thepowersgang opened this issue Jul 12, 2015 · 4 comments

Comments

@thepowersgang
Copy link
Contributor

It was noted in RFC 911 that unsafe const fn was an unresolved question.

Along with #913, adding support for unsafe const functions will allow constructing empty collections in statics (most likely wrapped with a mutex or similar). At the moment, this isn't possible as Unique's constructor is unsafe, and hence cannot be const (the compiler rejects such a definition)

@eddyb
Copy link
Member

eddyb commented Aug 9, 2015

Unique? But that's just an almost pointless wrapper that adds some markers to a non-null pointer - surely constructing such a value is as unsafe as creating an arbitrary *mut T?

@thepowersgang
Copy link
Contributor Author

@eddyb It also wraps NonZero, which is unsafe to construct.

@eddyb
Copy link
Member

eddyb commented Aug 9, 2015

Fair enough. Feel free to open a RFC modifying #911 to allow unsafe const fn, subject to the usual unsafety checks.

@thepowersgang
Copy link
Contributor Author

Closing issue, as the RFC PR has been filed.

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