Closed
Description
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
Metadata
Metadata
Assignees
Labels
Area: Constant evaluation, covers all const contexts (static, const fn, ...)Category: This is a bug.Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️High priorityRelevant to the compiler team, which will review and decide on the PR/issue.ICE tracked in rust-lang/glacier.Performance or correctness regression from one stable version to another.