-
Notifications
You must be signed in to change notification settings - Fork 58
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
Alignment at const time? #370
Comments
The best we could have is some kind of intrinsic |
This is needed to be able to safely re-interpret slice references and single references at compile time. I don't know what the answer is, but this is a huge deal for ergonomics if it can happen. |
Also see rust-lang/rust#102795 Note that even the thing that can happen will be much more limited than the runtime version. For example, when allocating a slice of |
I have the following function:
I'd like to make it a
const fn
, but if I just do that without changing the implementation, the compiler complains:This thread implies that there's no way to get this to work today (even by using unstable features). Is there intended to be a concept of alignment and const time? Will code like this ever be possible to write? This is relevant to zerocopy since I'd like to be able to do reference casts at const time where the target type has an alignment requirement greater than 1.
The text was updated successfully, but these errors were encountered: