mirror of
https://github.com/rust-lang/rust
synced 2024-11-05 20:45:15 +00:00
20 lines
432 B
Rust
20 lines
432 B
Rust
//@ run-rustfix
|
|
#![allow(dead_code, unused_variables)]
|
|
enum NonNullary {
|
|
Nullary,
|
|
Other(isize),
|
|
}
|
|
|
|
impl From<NonNullary> for isize {
|
|
fn from(val: NonNullary) -> isize {
|
|
match val {
|
|
NonNullary::Nullary => 0,
|
|
NonNullary::Other(i) => i,
|
|
}
|
|
}
|
|
}
|
|
|
|
fn main() {
|
|
let v = NonNullary::Nullary;
|
|
let val = v as isize; //~ ERROR non-primitive cast: `NonNullary` as `isize` [E0605]
|
|
}
|