Closed
Description
Following comparison leads to an internal compiler error:
if ('x' as char) < ('y' as char)
I tried this code:
fn main()
{
let x = 'x' as char;
let y = 'y' as char;
//if ('x' as char) < ('y' as char)
if x < y
{
print!("x");
}
else
{
print!("y");
}
}
I expected to see this happen: code compiles
Instead, this happened:
yoshiii@yoshiii-desktop:~/src/rust/bug$ cargo run
Compiling bug v0.1.0 (file:///home/yoshiii/src/rust/bug)
error: internal compiler error: /checkout/src/librustc_const_eval/eval.rs:773: impossible case reached
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
thread 'rustc' panicked at 'Box<Any>', /checkout/src/librustc_errors/lib.rs:418
note: Run with `RUST_BACKTRACE=1` for a backtrace.
error: Could not compile `bug`.
To learn more, run the command again with --verbose.
Meta
rustc --version --verbose
:
rustc 1.17.0 (56124baa9 2017-04-24)
binary: rustc
commit-hash: 56124baa9e73f28c0709e59e74783cf234a978cf
commit-date: 2017-04-24
host: x86_64-unknown-linux-gnu
release: 1.17.0
LLVM version: 3.9
Backtrace:
yoshiii@yoshiii-desktop:~/src/rust/bug$ RUST_BACKTRACE=1 cargo run
Compiling bug v0.1.0 (file:///home/yoshiii/src/rust/bug)
error: internal compiler error: /checkout/src/librustc_const_eval/eval.rs:773: impossible case reached
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: run with `RUST_BACKTRACE=1` for a backtrace
thread 'rustc' panicked at 'Box<Any>', /checkout/src/librustc_errors/lib.rs:418
stack backtrace:
0: std::sys::imp::backtrace::tracing::imp::unwind_backtrace
at /checkout/src/libstd/sys/unix/backtrace/tracing/gcc_s.rs:49
1: std::sys_common::backtrace::_print
at /checkout/src/libstd/sys_common/backtrace.rs:71
2: std::panicking::default_hook::{{closure}}
at /checkout/src/libstd/sys_common/backtrace.rs:60
at /checkout/src/libstd/panicking.rs:355
3: std::panicking::default_hook
at /checkout/src/libstd/panicking.rs:365
4: std::panicking::rust_panic_with_hook
at /checkout/src/libstd/panicking.rs:549
5: std::panicking::begin_panic
6: rustc_errors::Handler::bug
7: rustc::session::opt_span_bug_fmt::{{closure}}
8: rustc::session::opt_span_bug_fmt
9: rustc::session::bug_fmt
10: rustc_const_eval::eval::cast_const_int
11: rustc_const_eval::eval::eval_const_expr_partial
12: rustc_const_eval::eval::ConstContext::eval
13: <rustc_passes::consts::CheckCrateVisitor<'a, 'tcx> as rustc::hir::intravisit::Visitor<'tcx>>::visit_expr
14: <rustc_passes::consts::CheckCrateVisitor<'a, 'tcx> as rustc::hir::intravisit::Visitor<'tcx>>::visit_expr
15: <rustc_passes::consts::CheckCrateVisitor<'a, 'tcx> as rustc::hir::intravisit::Visitor<'tcx>>::visit_nested_body
16: rustc_passes::consts::check_crate
17: rustc_driver::driver::phase_3_run_analysis_passes::{{closure}}
18: rustc_driver::driver::phase_3_run_analysis_passes
19: rustc_driver::driver::compile_input
20: rustc_driver::run_compiler
21: std::panicking::try::do_call
22: __rust_maybe_catch_panic
at /checkout/src/libpanic_unwind/lib.rs:98
23: <F as alloc::boxed::FnBox<A>>::call_box
24: std::sys::imp::thread::Thread::new::thread_start
at /checkout/src/liballoc/boxed.rs:650
at /checkout/src/libstd/sys_common/thread.rs:21
at /checkout/src/libstd/sys/unix/thread.rs:84
25: start_thread
26: clone
error: Could not compile `bug`.
To learn more, run the command again with --verbose.