-
Notifications
You must be signed in to change notification settings - Fork 13.1k
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
Fix transmute::<T, U> where T requires a bigger alignment than U #33233
Conversation
For types that are not bitcast-compatible, transmute tries to avoid generating a temporary by translating its source expression directly into its destination, but when the source type has a bigger alignment requirement than the destination, this can lead to code that breaks due to misaligned stores. So in that case we need to generate a temporary for the source expression and then copy that into the destination, setting the proper alignment information on the memcpy/store. Fixes rust-lang#32947
r? @jroesch (rust_highfive has picked a reviewer for you, use r? to override) |
@bors r+ |
📌 Commit ab0de54 has been approved by |
Ah, right, the MIR implementation of |
⌛ Testing commit ab0de54 with merge 619f57e... |
⛄ The build was interrupted to prioritize another pull request. |
@bors r- |
ping @dotdash, any update on this? |
☔ The latest upstream changes (presumably #35764) made this pull request unmergeable. Please resolve the merge conflicts. |
Closing due to inactivity, but feel free to resubmit with a rebase! |
For types that are not bitcast-compatible, transmute tries to avoid
generating a temporary by translating its source expression directly
into its destination, but when the source type has a bigger alignment
requirement than the destination, this can lead to code that breaks due
to misaligned stores. So in that case we need to generate a temporary
for the source expression and then copy that into the destination,
setting the proper alignment information on the memcpy/store.
Fixes #32947