-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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
#[repr(align(8))]
is not accepted for arrays
#83595
Comments
Extra validation was added for situations where attributes were ignored (in this case it was #80641). Previous versions issued an If you want to align an array, I think you can wrap it in a struct with |
Nominating to see if this was an intended "lint -> hard error" change. (If there's another way to ask if a change is intended that people on @rustbot label: +I-nominated |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
1.50 didn't warn I think. I haven't specifically configured
That works, if the compiler guarantees that there will not be any padding at the beginning of |
It just ignored it: https://rust.godbolt.org/z/4rso564PP (Note also the warning for " It's my understanding that this is known and expected fallout from fixing compiler bugs where it had previously forgotten to run validation in certain positions. |
We discussed this in the lang team meeting today. This is an intentional bugfix to resolve a place where attributes weren't being checked but were supposed to have been. Note that this never did anything, so any (There have been a few of these, recently -- for example 1.49 fixed this on enum variants.)
|
Should |
Code
#[repr(align)]
was accepted for arrays in rust v1.50, but is rejected in v1.51.I am not entirely sure whether the attribute actually did the alignment in 1.50, or the compiler just ignored it. Regardless, is this expected behavior, and if it is how do I align an array?
The text was updated successfully, but these errors were encountered: