Skip to content

Compiler panic #24286

Closed
Closed
@linfir

Description

@linfir

I was trying to make a static reference to a closure.

I tried this code:

static digit: &'static (Fn(char) -> bool) = &(|c| c.is_digit(10));
fn main() {}

and the compiler panicked:

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
note: run with `RUST_BACKTRACE=1` for a backtrace
thread 'rustc' panicked at 'assertion failed: self.mode == Mode::Var', /home/rustbuild/src/rust-buildbot/slave/nightly-dist-rustc-linux/build/src/librustc/middle/check_const.rs:232

Meta

rustc --version --verbose:

rustc 1.0.0-nightly (6b95d8bed 2015-04-09) (built 2015-04-10)
binary: rustc
commit-hash: 6b95d8bed8afff7262ec5623677e320bf63d2230
commit-date: 2015-04-09
build-date: 2015-04-10
host: x86_64-unknown-linux-gnu
release: 1.0.0-nightly

Backtrace:

stack backtrace:
   1:     0x7fea30db6ea9 - sys::backtrace::write::h6bf89e75ba594056cRC
   2:     0x7fea30ddc877 - panicking::on_panic::hbf9e41a2aefa0bc6ghJ
   3:     0x7fea30d26152 - rt::unwind::begin_unwind_inner::h41f8448b15c8a007oWI
   4:     0x7fea2eba0fac - rt::unwind::begin_unwind::h3209015810365002052
   5:     0x7fea2ecfa532 - middle::check_const::CheckCrateVisitor<'a, 'tcx>.Visitor<'v>::visit_fn::h9e2b72185ca4471cF3d
   6:     0x7fea2ecfd36b - visit::walk_expr::h8386024076108125039
   7:     0x7fea2ecf46e8 - middle::check_const::CheckCrateVisitor<'a, 'tcx>.Visitor<'v>::visit_expr::h2bc92b3a34cb8841K5d
   8:     0x7fea2ecf46e8 - middle::check_const::CheckCrateVisitor<'a, 'tcx>.Visitor<'v>::visit_expr::h2bc92b3a34cb8841K5d
   9:     0x7fea2ecf46e8 - middle::check_const::CheckCrateVisitor<'a, 'tcx>.Visitor<'v>::visit_expr::h2bc92b3a34cb8841K5d
  10:     0x7fea2ecdf508 - middle::check_const::CheckCrateVisitor<'a, 'tcx>::global_expr::closure.77470
  11:     0x7fea2ecdf3c2 - middle::check_const::CheckCrateVisitor<'a, 'tcx>::global_expr::hfa8b1425325235abzUd
  12:     0x7fea2ecf9643 - middle::check_const::CheckCrateVisitor<'a, 'tcx>.Visitor<'v>::visit_item::hec6441b044337e29h0d
  13:     0x7fea2ed0135a - middle::check_const::check_crate::h95d234aafb3e8af4Hxe
  14:     0x7fea31428bd7 - driver::phase_3_run_analysis_passes::hfadc5ce25598c6e9pGa
  15:     0x7fea31409c55 - driver::compile_input::hda4dfeca75d4e6a1Qba
  16:     0x7fea314c8681 - run_compiler::hf377747becaeb45314b
  17:     0x7fea314c62d2 - boxed::F.FnBox<A>::call_box::h17590849261473092505
  18:     0x7fea314c5809 - rt::unwind::try::try_fn::h9501273623658247407
  19:     0x7fea30e527d8 - rust_try_inner
  20:     0x7fea30e527c5 - rust_try
  21:     0x7fea314c5ab8 - boxed::F.FnBox<A>::call_box::h4608839040711730637
  22:     0x7fea30dca201 - sys::thread::create::thread_start::h50d1a5ee6d64f2ceyRH
  23:     0x7fea2ade2b4f - start_thread
  24:     0x7fea309ab95c - <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