Skip to content

Internal Compiler Error #26286

Closed
Closed
@jtomschroeder

Description

@jtomschroeder

I was messing around with boxed closures and stumbled upon this compiler error:

src/main.rs:14:9: 14:43 error: internal compiler error: cannot relate bound region: ReScope(DestructionScope(24)) <= ReLateBound(DebruijnIndex { depth: 1 }, BrAnon(0))
src/main.rs:14         Class { methods: BTreeMap::new() }
                       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
thread 'rustc' panicked at 'Box<Any>', /Users/rustbuild/src/rust-buildbot/slave/nightly-dist-rustc-mac/build/src/libsyntax/diagnostic.rs:176

With this code:

use std::collections::BTreeMap;

pub trait Object {}

pub type Function = Box<Fn(Box<&Object>)>;

pub struct Class {
    pub methods: BTreeMap<String, Function>
}

impl Class {
    pub fn new() -> Class {
        Class { methods: BTreeMap::new() }
    }
}

Meta

rustc 1.2.0-nightly (c6b148337 2015-06-12)
binary: rustc
commit-hash: c6b14833771d0254d189b368b5ab41b295e02fd1
commit-date: 2015-06-12
host: x86_64-apple-darwin
release: 1.2.0-nightly

Backtrace:

stack backtrace:
   1:        0x1131ca8f5 - sys::backtrace::write::h6e963597537e900csas
   2:        0x1131d3080 - panicking::on_panic::hc6a54e36471e710eOtw
   3:        0x11318db78 - rt::unwind::begin_unwind_inner::hc2503abaf1a353b16bw
   4:        0x110d48d6e - rt::unwind::begin_unwind::h15793721380063878962
   5:        0x110d48cfa - diagnostic::SpanHandler::span_bug::h305c5fab12e5a61d9zA
   6:        0x1103bcdd4 - middle::infer::region_inference::RegionVarBindings<'a, 'tcx>::make_subregion::h061ca723d42f2b22kGx
   7:        0x1103d743b - middle::infer::mk_subr::h6aabeab28eb869bbiWA
   8:        0x10fee588a - check::regionck::type_must_outlive::h6127674586e2e829Cue
   9:        0x10fee3832 - check::dropck::iterate_over_potentially_unsafe_regions_in_type::hf0670724c6862f2eXDa
  10:        0x10fee39e6 - check::dropck::iterate_over_potentially_unsafe_regions_in_type::hf0670724c6862f2eXDa
  11:        0x10fee39e6 - check::dropck::iterate_over_potentially_unsafe_regions_in_type::hf0670724c6862f2eXDa
  12:        0x10fee3b8e - check::dropck::iterate_over_potentially_unsafe_regions_in_type::hf0670724c6862f2eXDa
  13:        0x10fee39e6 - check::dropck::iterate_over_potentially_unsafe_regions_in_type::hf0670724c6862f2eXDa
  14:        0x10fee39e6 - check::dropck::iterate_over_potentially_unsafe_regions_in_type::hf0670724c6862f2eXDa
  15:        0x10fee39e6 - check::dropck::iterate_over_potentially_unsafe_regions_in_type::hf0670724c6862f2eXDa
  16:        0x10fee2491 - check::dropck::check_safety_of_destructor_if_necessary::h79249887199f444e7xa
  17:        0x10ff197ce - check::regionck::check_safety_of_rvalue_destructor_if_necessary::h10b5f1bee99895872Pd
  18:        0x10ff12db3 - check::regionck::visit_expr::h7f33f51c105f70aaYad
  19:        0x10ff10bce - check::regionck::Rcx<'a, 'tcx>::visit_fn_body::h238c4dcb7b180b8eqNc
  20:        0x10ff0ff93 - check::regionck::regionck_fn::h9c58786b01e83d88MFc
  21:        0x10ff87ecd - check::check_bare_fn::h5e361559796822ecrPn
  22:        0x10ff94277 - check::check_method_body::h8f03cf9185cde476Aso
  23:        0x10ff85937 - check::check_item_body::h0b5b7f65588a40d3igo
  24:        0x10ff877f3 - check::check_item_types::h71eb55b1de3fcdd6YMn
  25:        0x11004825c - check_crate::h76434164527a1335W8C
  26:        0x10f877f7e - driver::phase_3_run_analysis_passes::hc0ba76a3f5e49d6cHGa
  27:        0x10f85ab93 - driver::compile_input::h31ee522441ce73a5Sba
  28:        0x10f917074 - run_compiler::h1c89bc44a6227123p6b
  29:        0x10f9147ea - boxed::F.FnBox<A>::call_box::h3142140668275512800
  30:        0x10f913f07 - rt::unwind::try::try_fn::h8655535135861126698
  31:        0x11325c418 - rust_try_inner
  32:        0x11325c405 - rust_try
  33:        0x1131bcd15 - rt::unwind::try::inner_try::hf8418fa68612ccb4Z7v
  34:        0x10f914162 - boxed::F.FnBox<A>::call_box::h9735321616466909895
  35:        0x1131d1bad - sys::thread::Thread::new::thread_start::h143ebbdca41cb5fdywv
  36:     0x7fff95422267 - _pthread_body
  37:     0x7fff954221e4 - _pthread_start

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