E0793: Clarify that it applies to unions as well#131472
Closed
kupiakos wants to merge 1 commit intorust-lang:masterfrom
Closed
E0793: Clarify that it applies to unions as well#131472kupiakos wants to merge 1 commit intorust-lang:masterfrom
kupiakos wants to merge 1 commit intorust-lang:masterfrom
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.
Collaborator
|
☔ 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. |
Contributor
There was a problem hiding this comment.
Suggested change
| // A reference to a packed union field causes a error. | |
| // A reference to a packed union field causes an error. |
Comment on lines
+74
to
+77
| // 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 |
Contributor
There was a problem hiding this comment.
Suggested change
| // 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 |
Contributor
|
@rustbot author |
Member
|
ping from triage - can you post your status on this PR and address the comments from the reviewer? |
Member
|
Closing this as inactive. Feel free to reöpen this pr or create a new pr if you get the time to work on this. Thanks |
Zalathar
added a commit
to Zalathar/rust
that referenced
this pull request
Aug 15, 2025
E0793: Clarify that it applies to unions as well pick up inactive PR: rust-lang#131472 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. r? compiler-errors
Zalathar
added a commit
to Zalathar/rust
that referenced
this pull request
Aug 15, 2025
E0793: Clarify that it applies to unions as well pick up inactive PR: rust-lang#131472 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. r? compiler-errors
Zalathar
added a commit
to Zalathar/rust
that referenced
this pull request
Aug 15, 2025
E0793: Clarify that it applies to unions as well pick up inactive PR: rust-lang#131472 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. r? compiler-errors
rust-timer
added a commit
that referenced
this pull request
Aug 15, 2025
Rollup merge of #144944 - He1pa:E0793, r=compiler-errors E0793: Clarify that it applies to unions as well pick up inactive PR: #131472 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. r? compiler-errors
github-actions bot
pushed a commit
to rust-lang/rustc-dev-guide
that referenced
this pull request
Aug 18, 2025
E0793: Clarify that it applies to unions as well pick up inactive PR: rust-lang/rust#131472 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. r? compiler-errors
Kobzol
pushed a commit
to Kobzol/rustc_codegen_gcc
that referenced
this pull request
Dec 21, 2025
E0793: Clarify that it applies to unions as well pick up inactive PR: rust-lang/rust#131472 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. r? compiler-errors
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Also:
was createdinstead ofgot created).union.This might need to wait for #131456 to merge first? Not sure.
r? compiler-errors