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.
I was looking at the unions in the Reference and got confused by the pattern matching section: https://doc.rust-lang.org/reference/items/unions.html#pattern-matching-on-unions
A catch-all arm with a union field will transmute all union values to that field's type, which was unexpected for me, even with the unsafe block required for union field accesses.
It's a little murky, but as far as I can tell this is not undefined behaviour in C, (but is in C++) according to:
and in this case, it's not a trap representation.
The explanation is a little rough. I thought I'd propose the general question idea and see if you'd like to include it. Please let me know whether you'd like me to rework the question details (maybe adding a constant value
1065353216
to make entering the correct answer easier).