Closed
Description
The following program (with perhaps undefined behaviour) causes an ICE:
fn ice() {
println!("{:?}", Some(257.0f32 as u8));
}
Interestingly, if not wrapping the result in a Some
, then there's no ICE.
fn no_ice() {
println!("{:?}", 257.0f32 as u8);
}
Here's the result from running it on the playground:
Compiling playground v0.0.1 (file:///playground)
error: internal compiler error: unexpected panic
note: the compiler unexpectedly panicked. this is a bug.
note: we would appreciate a bug report: https://github.com/rust-lang/rust/blob/master/CONTRIBUTING.md#bug-reports
note: rustc 1.20.0 (f3d6973f4 2017-08-27) running on x86_64-unknown-linux-gnu
thread 'rustc' panicked at 'assertion failed: !is_undef(val)', /checkout/src/librustc_trans/mir/constant.rs:1083:8
note: Run with `RUST_BACKTRACE=1` for a backtrace.
error: Could not compile `playground`.
To learn more, run the command again with --verbose.