Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

error: internal compiler error: /checkout/src/librustc_const_eval/eval.rs:773: impossible case reached #41998

Closed
yoshiii opened this issue May 14, 2017 · 1 comment
Labels
E-needs-test Call for participation: An issue has been fixed and does not reproduce, but no test has been added. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️

Comments

@yoshiii
Copy link

yoshiii commented May 14, 2017

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.
@Mark-Simulacrum Mark-Simulacrum added the I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ label May 14, 2017
@Mark-Simulacrum
Copy link
Member

This has been fixed since last stable, and works on today's beta, nightly, and master.

@eddyb eddyb added the E-needs-test Call for participation: An issue has been fixed and does not reproduce, but no test has been added. label Jun 7, 2017
Mark-Simulacrum added a commit to Mark-Simulacrum/rust that referenced this issue Jun 22, 2017
Add tests for a few issues.

Fixes rust-lang#41998
Fixes rust-lang#38381
Fixes rust-lang#37515
Fixes rust-lang#37510
Fixes rust-lang#37508
Fixes rust-lang#37366
Fixes rust-lang#37323
Fixes rust-lang#37051
Fixes rust-lang#36839
Fixes rust-lang#35570
Fixes rust-lang#34373
Fixes rust-lang#34222

Certainly not all of the E-needstest issues right now, but I started to get bored.
bors added a commit that referenced this issue Jun 24, 2017
Add tests for a few issues.

Fixes #41998
Fixes #38381
Fixes #37515
Fixes #37510
Fixes #37366
Fixes #37323
Fixes #37051
Fixes #36839
Fixes #35570
Fixes #34373
Fixes #34222

Certainly not all of the E-needstest issues right now, but I started to get bored.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
E-needs-test Call for participation: An issue has been fixed and does not reproduce, but no test has been added. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️
Projects
None yet
Development

No branches or pull requests

3 participants