-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Closed
Labels
C-bugCategory: This is a bug.Category: This is a bug.E-help-wantedCall for participation: Help is requested to fix this issue.Call for participation: Help is requested to fix this issue.F-non_exhaustive`#![feature(non_exhaustive)]``#![feature(non_exhaustive)]`T-langRelevant to the language teamRelevant to the language team
Description
This currently compiles
// in crate 1
#[repr(u8)]
enum Foo {
A,
#[non_exhaustive]
B,
}
// in crate 2
fn demo(f: Foo) -> u8 {
f as u8
}
However, that as
cast would be an erroneous "non-primitive cast" if the variant ever got any fields, as it's allowed to do by the #[non_exhaustive]
.
Thus we need to fix the compiler so that the cast is rejected outside the crate that owns Foo
.
Metadata
Metadata
Assignees
Labels
C-bugCategory: This is a bug.Category: This is a bug.E-help-wantedCall for participation: Help is requested to fix this issue.Call for participation: Help is requested to fix this issue.F-non_exhaustive`#![feature(non_exhaustive)]``#![feature(non_exhaustive)]`T-langRelevant to the language teamRelevant to the language team