2

[diagnostics] Add mentions to `Copy` types being valid for `union` fields by dan...

 2 years ago
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.
neoserver,ios ssh client

Copy link

Contributor

danielhenrymantilla commented 10 days ago

edited

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 unions are concerned, people are dealing with PODs / Copy types anyways slightly_smiling_face


@rustbot modify labels: +A-diagnostics +D-terse


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK