Skip to content

ICE in librustc/middle/const_eval.rs #30216

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

Closed
ia0 opened this issue Dec 5, 2015 · 5 comments
Closed

ICE in librustc/middle/const_eval.rs #30216

ia0 opened this issue Dec 5, 2015 · 5 comments
Labels
I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️

Comments

@ia0
Copy link
Contributor

ia0 commented Dec 5, 2015

The compiler unexpectedly panicked.

I was working on a crate when cargo build gave an ICE. I tried to reduce the code and command-line.

Content of ice.rs:

fn div_ceil(x: usize, m: usize) -> usize { (x + m - 1) / m }
fn f1(x: &[u8], n: usize, i: usize) {}
fn f2(x: &[u8], n: usize, i: usize) {}
fn f3<B: Foo>(x: &B) {}
fn f4<B: Foo>(x: &B) { unreachable!() }
fn f5<B: Foo>(_: &B) -> usize { 0 }
pub trait Foo {}
pub fn entry<F: Foo>(x: &F) -> u64 { 0u64 << f5(x) }
fn main() {}

rustc --version --verbose:

rustc 1.6.0-nightly (abfadfeee 2015-12-02)
binary: rustc
commit-hash: abfadfeee691f832b3b47ebd334ec119b0a8379d
commit-date: 2015-12-02
host: x86_64-unknown-linux-gnu
release: 1.6.0-nightly

RUST_BACKTRACE=1 rustc ice.rs:

ice.rs:1:1: 1:61 warning: function is never used: `div_ceil`, #[warn(dead_code)] on by default
ice.rs:1 fn div_ceil(x: usize, m: usize) -> usize { (x + m - 1) / m }
         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
ice.rs:2:1: 2:39 warning: function is never used: `f1`, #[warn(dead_code)] on by default
ice.rs:2 fn f1(x: &[u8], n: usize, i: usize) {}
         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
ice.rs:2:7: 2:8 warning: unused variable: `x`, #[warn(unused_variables)] on by default
ice.rs:2 fn f1(x: &[u8], n: usize, i: usize) {}
               ^
ice.rs:2:17: 2:18 warning: unused variable: `n`, #[warn(unused_variables)] on by default
ice.rs:2 fn f1(x: &[u8], n: usize, i: usize) {}
                         ^
ice.rs:2:27: 2:28 warning: unused variable: `i`, #[warn(unused_variables)] on by default
ice.rs:2 fn f1(x: &[u8], n: usize, i: usize) {}
                                   ^
ice.rs:3:1: 3:39 warning: function is never used: `f2`, #[warn(dead_code)] on by default
ice.rs:3 fn f2(x: &[u8], n: usize, i: usize) {}
         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
ice.rs:3:7: 3:8 warning: unused variable: `x`, #[warn(unused_variables)] on by default
ice.rs:3 fn f2(x: &[u8], n: usize, i: usize) {}
               ^
ice.rs:3:17: 3:18 warning: unused variable: `n`, #[warn(unused_variables)] on by default
ice.rs:3 fn f2(x: &[u8], n: usize, i: usize) {}
                         ^
ice.rs:3:27: 3:28 warning: unused variable: `i`, #[warn(unused_variables)] on by default
ice.rs:3 fn f2(x: &[u8], n: usize, i: usize) {}
                                   ^
ice.rs:4:1: 4:24 warning: function is never used: `f3`, #[warn(dead_code)] on by default
ice.rs:4 fn f3<B: Foo>(x: &B) {}
         ^~~~~~~~~~~~~~~~~~~~~~~
ice.rs:4:15: 4:16 warning: unused variable: `x`, #[warn(unused_variables)] on by default
ice.rs:4 fn f3<B: Foo>(x: &B) {}
                       ^
ice.rs:5:1: 5:40 warning: function is never used: `f4`, #[warn(dead_code)] on by default
ice.rs:5 fn f4<B: Foo>(x: &B) { unreachable!() }
         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
ice.rs:5:15: 5:16 warning: unused variable: `x`, #[warn(unused_variables)] on by default
ice.rs:5 fn f4<B: Foo>(x: &B) { unreachable!() }
                       ^
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
thread 'rustc' panicked at 'assertion failed: `(left == right)` (left: `3`, right: `1`)', ../src/librustc/middle/const_eval.rs:1110
stack backtrace:
   1:     0x7f3279f1b1f0 - sys::backtrace::tracing::imp::write::ha5f3f0d9df3eccc0xXt
   2:     0x7f3279f21e75 - panicking::log_panic::_<closure>::closure.41172
   3:     0x7f3279f2190f - panicking::log_panic::hb6d5879621a98ec062x
   4:     0x7f3279eea7f3 - sys_common::unwind::begin_unwind_inner::h56feb86a7746f2474Ps
   5:     0x7f3279eeb158 - sys_common::unwind::begin_unwind_fmt::hbd638ea70768c304aPs
   6:     0x7f327784d3f0 - middle::const_eval::eval_const_expr_partial::h2533bfe6c1962b66I9l
   7:     0x7f32786485f7 - types::_<impl>::check_expr::hfc38773ffed22370aLb
   8:     0x7f3277a3aeef - lint::context::_<impl>::visit_expr::h8b9870a4ad638ad0DRp
   9:     0x7f3277a3b7ab - lint::context::_<impl>::visit_fn::h8832c50f3c478cc15Sp
  10:     0x7f3277a36c5b - lint::context::_<impl>::visit_item::h4cb67b33f26f536fTOp
  11:     0x7f3277a3ba8b - lint::context::_<impl>::visit_mod::h08bcb71d52cb2f19EZp
  12:     0x7f3277a57131 - lint::context::check_crate::h2219a7117ade41ab7Bq
  13:     0x7f327a42396c - driver::phase_3_run_analysis_passes::_<closure>::closure.25592
  14:     0x7f327a402e43 - middle::ty::context::_<impl>::create_and_enter::create_and_enter::h11817769863191690492
  15:     0x7f327a3fe1fb - driver::phase_3_run_analysis_passes::h5750652185230913258
  16:     0x7f327a3d04a9 - driver::compile_input::hc44b9e449347f9a1jca
  17:     0x7f327a3c261b - run_compiler::he3da9dd626b2ff2a0wc
  18:     0x7f327a3bf2d6 - sys_common::unwind::try::try_fn::try_fn::h16654195298631707248
  19:     0x7f3279f18e88 - __rust_try
  20:     0x7f3279f1078b - sys_common::unwind::try::inner_try::hb614b0fa85d9fb24CMs
  21:     0x7f327a3bf630 - boxed::_<impl>::call_box::call_box::h11236117354921040822
  22:     0x7f3279f20393 - sys::thread::_<impl>::new::thread_start::h73d591f2e83d6559I5w
  23:     0x7f32731d0181 - start_thread
  24:     0x7f3279b9e47c - __clone
  25:                0x0 - <unknown>

@jdm jdm added the I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ label Dec 5, 2015
@Manishearth
Copy link
Member

cc @oli-obk

@oli-obk
Copy link
Contributor

oli-obk commented Dec 5, 2015

#29927 is responsible for this, which I fixed in #30141 ... rebasing now :)

@Manishearth
Copy link
Member

dupe of #29927

@oli-obk
Copy link
Contributor

oli-obk commented Dec 5, 2015

in fact, this should be fixed since of 20h ago in #30084 . I think that fix accidentally snuck in there.

@ia0
Copy link
Contributor Author

ia0 commented Dec 6, 2015

Indeed, I tried with rustc 1.6.0-nightly (aad4e5665 2015-12-05) and it works. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️
Projects
None yet
Development

No branches or pull requests

4 participants