-
Notifications
You must be signed in to change notification settings - Fork 13.4k
CStr unchecked constructor can be a const fn #54678
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
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: