-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Closed
Labels
T-langRelevant to the language teamRelevant to the language team
Description
enum Void { }
fn void_as_usize(x: Void) -> usize { x as usize } // fails, non-primitive cast
As reported on Zulip: https://rust-lang.zulipchat.com/#narrow/stream/122651-general/topic/void.20as.20usize
This works for simple enums with one or more variants, but for zero it fails, possibly due to interaction with #[repr(C)]
. This kind of code can come up in macro code.
cc @RalfJung
dylni
Metadata
Metadata
Assignees
Labels
T-langRelevant to the language teamRelevant to the language team