-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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
E0793: Clarify that it applies to unions as well #131472
base: master
Are you sure you want to change the base?
Conversation
Also: - Adjust the language slightly to be more consistent with other similar messages (`was created` instead of `got created`). - Add a short section on `union` - Add an example line showing referencing a field in a packed struct is safe if the field's type isn't more strictly aligned than the pack.
☔ The latest upstream changes (presumably #131458) made this pull request unmergeable. Please resolve the merge conflicts. |
let foo = Foo { field1: 0 }; | ||
// Accessing the field directly is fine. | ||
let val = foo.field1; | ||
// A reference to a packed union field causes a error. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// A reference to a packed union field causes a error. | |
// A reference to a packed union field causes an error. |
// Accessing the field directly is fine. | ||
let val = foo.field1; | ||
// A reference to a packed union field causes a error. | ||
let val = &foo.field1; // ERROR |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// Accessing the field directly is fine. | |
let val = foo.field1; | |
// A reference to a packed union field causes a error. | |
let val = &foo.field1; // ERROR | |
// Accessing the field directly is fine. | |
let val = foo.field1; | |
// A reference to a packed union field causes a error. | |
let val = &foo.field1; // ERROR |
@rustbot author |
ping from triage - can you post your status on this PR and address the comments from the reviewer? |
Also:
was created
instead ofgot created
).union
.This might need to wait for #131456 to merge first? Not sure.
r? compiler-errors