Skip to content

ICE in rustc from function call in RHS of const definition #28113

Closed
@teisenbe

Description

@teisenbe

I tried this code:

const X: u8 = || -> u8 { 5 }();

I expected to see this happen: Either a compilation error, or to be equivalent to const X: u8 = 5.

Instead, this happened: Internal compiler error

Meta

rustc --version --verbose:

rustc 1.4.0-nightly (20a8412e0 2015-08-28)
binary: rustc
commit-hash: 20a8412e09e2883489736b4ae3dc138f243d1a17
commit-date: 2015-08-28
host: x86_64-unknown-linux-gnu
release: 1.4.0-nightly

Backtrace:

thread 'rustc' panicked at 'assertion failed: self.inh.deferred_call_resolutions.borrow().is_empty()', ../src/librustc_typeck/check/mod.rs:2023

stack backtrace:
   1:     0x7fc7fbaf90a9 - sys::backtrace::tracing::imp::write::he11991336d112ae3Aes
   2:     0x7fc7fbb00d76 - panicking::on_panic::hd741984fb33f3e317ex
   3:     0x7fc7fbac55de - rt::unwind::begin_unwind_inner::h837b3c3463e1a06eLHw
   4:     0x7fc7fab0ca9f - rt::unwind::begin_unwind::h10622579821064218427
   5:     0x7fc7fab3216c - check::FnCtxt<'a, 'tcx>::select_all_obligations_or_error::h966bbb42357b6836dvr
   6:     0x7fc7fabd43fc - check::check_const::hbed0eb360d678b26Acu
   7:     0x7fc7fabc22c7 - check::check_item_type::h25c10dc6ab99c072tKp
   8:     0x7fc7fac84392 - check_crate::hf540b00aced9403awAE
   9:     0x7fc7fc049a8e - driver::phase_3_run_analysis_passes::closure.20656
  10:     0x7fc7fc02c0c3 - middle::ty::ctxt<'tcx>::create_and_enter::h8301109304510330010
  11:     0x7fc7fc02745d - driver::phase_3_run_analysis_passes::h13747097652036984327
  12:     0x7fc7fc00a876 - driver::compile_input::h0626ad86fff9a5b9Tba
  13:     0x7fc7fc16c98b - run_compiler::h4c5bab99983d75bd0bc
  14:     0x7fc7fc16a257 - boxed::F.FnBox<A>::call_box::h7998076066074844987
  15:     0x7fc7fc169cc4 - rt::unwind::try::try_fn::h11048267709636862519
  16:     0x7fc7fbb00918 - __rust_try
  17:     0x7fc7fbaed1d2 - rt::unwind::try::inner_try::h62b49309b595e978EDw
  18:     0x7fc7fc169e58 - boxed::F.FnBox<A>::call_box::h8109257951937123469
  19:     0x7fc7fbaffd63 - sys::thread::Thread::new::thread_start::h78cb9ca46e8b6bb6rNv
  20:     0x7fc7f56c0181 - start_thread
  21:     0x7fc7fb77947c - __clone
  22:                0x0 - <unknown>

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

    Development

    No branches or pull requests

    Issue actions