Closed
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
.