[diagnostics] Add mentions to `Copy` types being valid for `union` fields by dan...
source link: https://github.com/rust-lang/rust/pull/94031
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
This came up from some user on Discord which was using a T : PrimitiveInt
generic type, and they wanted to use in a union
. Rather than adding a Copy
bound, they started pondering about the ManuallyDrop<T>
road, and how to correctly use unsafe
to perform the drops.
So, it seemed like the error message for types with potential drop glue on union
fields could be improved to also mention the Copy
alternative, since in many cases where union
s are concerned, people are dealing with PODs / Copy
types anyways
@rustbot modify labels: +A-diagnostics +D-terse
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK