<p dir="auto">I was messing around with boxed closures and stumbled upon this compiler error:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="src/main.rs:14:9: 14:43 error: internal compiler error: cannot relate bound region: ReScope(DestructionScope(24)) &lt;= ReLateBound(DebruijnIndex { depth: 1 }, BrAnon(0))
src/main.rs:14         Class { methods: BTreeMap::new() }
                       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
thread 'rustc' panicked at 'Box&lt;Any&gt;', /Users/rustbuild/src/rust-buildbot/slave/nightly-dist-rustc-mac/build/src/libsyntax/diagnostic.rs:176"><pre class="notranslate"><code class="notranslate">src/main.rs:14:9: 14:43 error: internal compiler error: cannot relate bound region: ReScope(DestructionScope(24)) &lt;= ReLateBound(DebruijnIndex { depth: 1 }, BrAnon(0))
src/main.rs:14         Class { methods: BTreeMap::new() }
                       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
thread 'rustc' panicked at 'Box&lt;Any&gt;', /Users/rustbuild/src/rust-buildbot/slave/nightly-dist-rustc-mac/build/src/libsyntax/diagnostic.rs:176
</code></pre></div>
<p dir="auto">With this code:</p>
<div class="highlight highlight-source-rust notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="use std::collections::BTreeMap;

pub trait Object {}

pub type Function = Box&lt;Fn(Box&lt;&amp;Object&gt;)&gt;;

pub struct Class {
    pub methods: BTreeMap&lt;String, Function&gt;
}

impl Class {
    pub fn new() -&gt; Class {
        Class { methods: BTreeMap::new() }
    }
}"><pre class="notranslate"><span class="pl-k">use</span> std<span class="pl-kos">::</span>collections<span class="pl-kos">::</span><span class="pl-v">BTreeMap</span><span class="pl-kos">;</span>

<span class="pl-k">pub</span> <span class="pl-k">trait</span> <span class="pl-smi">Object</span> <span class="pl-kos">{</span><span class="pl-kos">}</span>

<span class="pl-k">pub</span> <span class="pl-k">type</span> <span class="pl-smi">Function</span> = <span class="pl-smi">Box</span><span class="pl-kos">&lt;</span><span class="pl-smi">Fn</span><span class="pl-kos">(</span><span class="pl-smi">Box</span><span class="pl-kos">&lt;</span><span class="pl-c1">&amp;</span><span class="pl-smi">Object</span><span class="pl-kos">&gt;</span><span class="pl-kos">)</span><span class="pl-kos">&gt;</span><span class="pl-kos">;</span>

<span class="pl-k">pub</span> <span class="pl-k">struct</span> <span class="pl-smi">Class</span> <span class="pl-kos">{</span>
    <span class="pl-k">pub</span> <span class="pl-c1">methods</span><span class="pl-kos">:</span> <span class="pl-smi">BTreeMap</span><span class="pl-kos">&lt;</span><span class="pl-smi">String</span><span class="pl-kos">,</span> <span class="pl-smi">Function</span><span class="pl-kos">&gt;</span>
<span class="pl-kos">}</span>

<span class="pl-k">impl</span> <span class="pl-smi">Class</span> <span class="pl-kos">{</span>
    <span class="pl-k">pub</span> <span class="pl-k">fn</span> <span class="pl-en">new</span><span class="pl-kos">(</span><span class="pl-kos">)</span> -&gt; <span class="pl-smi">Class</span> <span class="pl-kos">{</span>
        <span class="pl-smi">Class</span> <span class="pl-kos">{</span> <span class="pl-c1">methods</span><span class="pl-kos">:</span> <span class="pl-smi">BTreeMap</span><span class="pl-kos">::</span><span class="pl-en">new</span><span class="pl-kos">(</span><span class="pl-kos">)</span> <span class="pl-kos">}</span>
    <span class="pl-kos">}</span>
<span class="pl-kos">}</span></pre></div>
<h2 dir="auto">Meta</h2>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="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"><pre class="notranslate"><code class="notranslate">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
</code></pre></div>
<p dir="auto">Backtrace:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="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&lt;'a, 'tcx&gt;::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&lt;'a, 'tcx&gt;::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&lt;A&gt;::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&lt;A&gt;::call_box::h9735321616466909895
  35:        0x1131d1bad - sys::thread::Thread::new::thread_start::h143ebbdca41cb5fdywv
  36:     0x7fff95422267 - _pthread_body
  37:     0x7fff954221e4 - _pthread_start"><pre class="notranslate"><code class="notranslate">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&lt;'a, 'tcx&gt;::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&lt;'a, 'tcx&gt;::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&lt;A&gt;::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&lt;A&gt;::call_box::h9735321616466909895
  35:        0x1131d1bad - sys::thread::Thread::new::thread_start::h143ebbdca41cb5fdywv
  36:     0x7fff95422267 - _pthread_body
  37:     0x7fff954221e4 - _pthread_start
</code></pre></div>
<p dir="auto">I hit an internal compiler error with this weeks build. It occurs when I try to build <a href="https://github.com/Kintaro/wtftw/tree/1d8040fddfedfd3b111bb4d5a8466fcb8120e339">https://github.com/Kintaro/wtftw/tree/1d8040fddfedfd3b111bb4d5a8466fcb8120e339</a></p>
<p dir="auto">Error output and rustc version are below.</p>
<p dir="auto">rustc 1.2.0-dev (<a class="commit-link" data-hovercard-type="commit" data-hovercard-url="https://github.com/rust-lang/rust/commit/0fc0476e6ae2bcc5cce75d78548cf037b6692a97/hovercard" href="https://github.com/rust-lang/rust/commit/0fc0476e6ae2bcc5cce75d78548cf037b6692a97"><tt>0fc0476</tt></a> 2015-05-24) (built 2015-05-24)</p>
<p dir="auto">Unfortunately, <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="78637616" data-permission-text="Title is private" data-url="https://github.com/rust-lang/rust/issues/25652" data-hovercard-type="pull_request" data-hovercard-url="/rust-lang/rust/pull/25652/hovercard" href="https://github.com/rust-lang/rust/pull/25652">#25652</a> did not fix the issue. It's caused by this part here <a href="https://github.com/Kintaro/wtftw/blob/1d8040fddfedfd3b111bb4d5a8466fcb8120e339/core/src/config.rs#L110">https://github.com/Kintaro/wtftw/blob/1d8040fddfedfd3b111bb4d5a8466fcb8120e339/core/src/config.rs#L110</a></p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="core/src/config.rs:116:13: 116:28 error: internal compiler error: cannot relate bound region: ReScope(Remainder(BlockRemainder { block: 150, first_statement_index: 3 })) &lt;= ReLateBound(DebruijnIndex { depth: 1 }, BrAnon(0))
core/src/config.rs:116         let internal_config = 
                                   ^~~~~~~~~~~~~~~
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&lt;Any&gt;', /home/rootnode/programs/src/rust/src/libsyntax/diagnostic.rs:176"><pre class="notranslate"><code class="notranslate">core/src/config.rs:116:13: 116:28 error: internal compiler error: cannot relate bound region: ReScope(Remainder(BlockRemainder { block: 150, first_statement_index: 3 })) &lt;= ReLateBound(DebruijnIndex { depth: 1 }, BrAnon(0))
core/src/config.rs:116         let internal_config = 
                                   ^~~~~~~~~~~~~~~
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&lt;Any&gt;', /home/rootnode/programs/src/rust/src/libsyntax/diagnostic.rs:176
</code></pre></div>