Skip to content

ICE in librustc_const_eval: bad ty_hint: TyBool, Int(1, Unsuffixed) #39548

@scottmcm

Description

@scottmcm
Member

Playing with different ways to do static_assert!, I found an ICE. Reduced testcase:

fn main() {
    let _ : [(); ((1 < 2) == false) as usize] = [];
}

Happens in stable and nightly; here's the nightly backtrace from play:

rustc 1.16.0-nightly (eedaa94e3 2017-02-02)
error: internal compiler error: /buildslave/rust-buildbot/slave/nightly-dist-rustc-linux/build/src/librustc_const_eval/eval.rs:1105: bad ty_hint: TyBool, Int(1, Unsuffixed)

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>', /buildslave/rust-buildbot/slave/nightly-dist-rustc-linux/build/src/librustc_errors/lib.rs:416
stack backtrace:
   1:     0x7f958019e45c - std::sys::imp::backtrace::tracing::imp::write::hf7294f5e24536b4a
                        at /buildslave/rust-buildbot/slave/nightly-dist-rustc-linux/build/src/libstd/sys/unix/backtrace/tracing/gcc_s.rs:42
   2:     0x7f95801ac90e - std::panicking::default_hook::{{closure}}::h9a07d0b00c43fbee
                        at /buildslave/rust-buildbot/slave/nightly-dist-rustc-linux/build/src/libstd/panicking.rs:351
   3:     0x7f95801ac4b3 - std::panicking::default_hook::hf25feff2d08bf39b
                        at /buildslave/rust-buildbot/slave/nightly-dist-rustc-linux/build/src/libstd/panicking.rs:361
   4:     0x7f95801acdab - std::panicking::rust_panic_with_hook::h4cb8c6fbb8386ccf
                        at /buildslave/rust-buildbot/slave/nightly-dist-rustc-linux/build/src/libstd/panicking.rs:555
   5:     0x7f95787bce37 - std::panicking::begin_panic::h133cfd00382ed92d
   6:     0x7f95787d251d - rustc_errors::Handler::bug::h0c95eedc3adddeaa
   7:     0x7f957d2cf10a - rustc::session::opt_span_bug_fmt::{{closure}}::hb77f1c2804eeb101
   8:     0x7f957d2cebc5 - rustc::session::opt_span_bug_fmt::h6020528146c503fb
   9:     0x7f957d2ce822 - rustc::session::bug_fmt::h80c5b006234b3146
  10:     0x7f957e0d3f36 - rustc_const_eval::eval::eval_const_expr_partial::h8d1162fa05e95e72
  11:     0x7f957e0cdad1 - rustc_const_eval::eval::eval_const_expr_partial::h8d1162fa05e95e72
  12:     0x7f957e0cdad1 - rustc_const_eval::eval::eval_const_expr_partial::h8d1162fa05e95e72
  13:     0x7f957e0cdd5e - rustc_const_eval::eval::eval_const_expr_partial::h8d1162fa05e95e72
  14:     0x7f957e0d64b3 - rustc_const_eval::eval::eval_length::h137b8f408aab940b
  15:     0x7f957ebdf58b - <rustc_typeck::astconv::AstConv<'gcx, 'tcx> + 'o>::ast_ty_to_ty::hf1f13e8dab321530
  16:     0x7f957eba1553 - <rustc_typeck::check::GatherLocalsVisitor<'a, 'gcx, 'tcx> as rustc::hir::intravisit::Visitor<'gcx>>::visit_local::h3eb6465c4518baea
  17:     0x7f957eb102d6 - rustc::hir::intravisit::walk_expr::h1fd71fafa6424277
  18:     0x7f957eba1cd5 - rustc_typeck::check::check_fn::hdcc283c26b22bc9e
  19:     0x7f957eba0f04 - rustc_typeck::check::check_bare_fn::hf15cf554a01d6e48
  20:     0x7f957eb9e0f5 - rustc_typeck::check::check_item_bodies::ha330650a58a36448
  21:     0x7f957ec0ba47 - rustc_typeck::check_crate::h06f4ceb61c7f6528
  22:     0x7f958054af27 - rustc_driver::driver::phase_3_run_analysis_passes::{{closure}}::h074ad5edbf4a7db7
  23:     0x7f958053d356 - rustc_driver::driver::phase_3_run_analysis_passes::h380fa931cb354859
  24:     0x7f958052b160 - rustc_driver::driver::compile_input::hab977ae496b3a6f1
  25:     0x7f9580575a94 - rustc_driver::run_compiler::h81290683db66a63c
  26:     0x7f9580481ebb - std::panicking::try::do_call::h00942d7a5d04424f
  27:     0x7f95801b5bea - __rust_maybe_catch_panic
                        at /buildslave/rust-buildbot/slave/nightly-dist-rustc-linux/build/src/libpanic_unwind/lib.rs:98
  28:     0x7f95804aa122 - <F as alloc::boxed::FnBox<A>>::call_box::hd87f7ab2fccbd670
  29:     0x7f95801ab764 - std::sys::imp::thread::Thread::new::thread_start::hc16926852e47c008
                        at /buildslave/rust-buildbot/slave/nightly-dist-rustc-linux/build/src/liballoc/boxed.rs:624
                        at /buildslave/rust-buildbot/slave/nightly-dist-rustc-linux/build/src/libstd/sys_common/thread.rs:21
                        at /buildslave/rust-buildbot/slave/nightly-dist-rustc-linux/build/src/libstd/sys/unix/thread.rs:84
  30:     0x7f9577f676b9 - start_thread
  31:     0x7f957fe6182c - clone
  32:                0x0 - <unknown>

Activity

added
I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️
on Feb 6, 2017
larsluthman

larsluthman commented on Feb 14, 2017

@larsluthman

My fix attempt is at #39812 .

added 8 commits that reference this issue on Feb 25, 2017
136d4d0
1b8de36
67a5171
e1cb9ba
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Participants

      @arielb1@larsluthman@scottmcm

      Issue actions

        ICE in librustc_const_eval: bad ty_hint: TyBool, Int(1, Unsuffixed) · Issue #39548 · rust-lang/rust