RFC 3458 states:
The use of unsafe fields on unions shall remain [semantically] forbidden while the impact of this feature on unions is decided.
"impact of this feature on unions" links to Future possibility "Safe Unions", so it doesn't seem "decided".
However, the compiler accepts this code:
#![feature(unsafe_fields)]
union U { unsafe f: () }
That's most likely the case because the reviewer of the initial implementation seemingly requested this behavior in #132915 (comment) (but it's unclear whether they were referring to the syntax or the semantics which might have been the cause of this confusion).
The current behavior is exercised in tests/ui/unsafe-fields/unsafe-fields.rs.
I've grepped through the PR comments of the RFC and of the initial implementation but couldn't find anything that would explain this discrepancy.
RFC 3458 states:
"impact of this feature on unions" links to Future possibility "Safe Unions", so it doesn't seem "decided".
However, the compiler accepts this code:
That's most likely the case because the reviewer of the initial implementation seemingly requested this behavior in #132915 (comment) (but it's unclear whether they were referring to the syntax or the semantics which might have been the cause of this confusion).
The current behavior is exercised in
tests/ui/unsafe-fields/unsafe-fields.rs.I've grepped through the PR comments of the RFC and of the initial implementation but couldn't find anything that would explain this discrepancy.