-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
CStr unchecked constructor can be a const fn #54678
Comments
At this point you can just enable the |
Alternatively, why can't we make DST constructors work for simple wrappers like this? Why can't it be, e.g.
Where it looks kind of like the opposite of a deref coercion, and the compiler just reinterprets the fat pointer? This would eliminate the need for any |
Yes I would like such constructors, too. But that needs and RFC and probably has a lot of caveats that we want to think about. I did not know about that issue. I commented there. |
make `CStr::from_bytes_with_nul_unchecked()` a const fn closes rust-lang#54678
make `CStr::from_bytes_with_nul_unchecked()` a const fn closes rust-lang#54678
The current implementation of
CStr::from_bytes_with_nul_unchecked()
is not valid in a const context, but it can easily be tweaked so that it is:The text was updated successfully, but these errors were encountered: