Compiling this code on playground:
enum Nums {
NegOne = -1,
}
fn main() {
let kind = Nums::NegOne;
let _v = kind as i32;
}
results in ICE. Casting to anything smaller than usize/isize(u32, u16, i16, u8, i8, etc) also results in ICE. Casting to anything same size or larger(u128, i128, u64, i64, etc) works fine. Positive discriminant values also work fine.
Version of rustc: rustc 1.42.0 (b8cedc004 2020-03-09) running on x86_64-unknown-linux-gnu(on rust playground)
Compiler flags listed as used: -C codegen-units=1 -C debuginfo=2 --crate-type bin
Compiling this code on playground:
results in ICE. Casting to anything smaller than
usize/isize(u32,u16,i16,u8,i8, etc) also results in ICE. Casting to anything same size or larger(u128,i128,u64,i64, etc) works fine. Positive discriminant values also work fine.Version of rustc:
rustc 1.42.0 (b8cedc004 2020-03-09) running on x86_64-unknown-linux-gnu(on rust playground)Compiler flags listed as used:
-C codegen-units=1 -C debuginfo=2 --crate-type bin