<p dir="auto">ICE (panic) when compiling following code, adding lifetime to ValuesIter (as in commented line) fixes the crash</p>
<div class="highlight highlight-source-rust notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="trait Data {
  fn values_iter(&amp;self) -&gt; Values;
}


struct Values&lt;'a&gt; {
  iter: Box&lt;Iterator&lt;Item=&amp;'a Data&gt;&gt;
}

type ValuesIter&lt;'a&gt; = Box&lt;Iterator&lt;Item=&amp;'a Data&gt;&gt;;

impl &lt;'a&gt; Values&lt;'a&gt; {
  // fn use_iter(consume_iter: ValuesIter&lt;'a&gt;) -&gt; Values {  // non cashing version
  fn use_iter(consume_iter: ValuesIter) -&gt; Values {
    Values {
      iter: consume_iter
    }
  }
}



fn main() {

}"><pre class="notranslate"><span class="pl-k">trait</span> <span class="pl-smi">Data</span> <span class="pl-kos">{</span>
  <span class="pl-k">fn</span> <span class="pl-en">values_iter</span><span class="pl-kos">(</span><span class="pl-c1">&amp;</span><span class="pl-smi">self</span><span class="pl-kos">)</span> -&gt; <span class="pl-smi">Values</span><span class="pl-kos">;</span>
<span class="pl-kos">}</span>


<span class="pl-k">struct</span> <span class="pl-smi">Values</span><span class="pl-kos">&lt;</span><span class="pl-c1">'</span><span class="pl-ent">a</span><span class="pl-kos">&gt;</span> <span class="pl-kos">{</span>
  <span class="pl-c1">iter</span><span class="pl-kos">:</span> <span class="pl-smi">Box</span><span class="pl-kos">&lt;</span><span class="pl-smi">Iterator</span><span class="pl-kos">&lt;</span><span class="pl-smi">Item</span>=<span class="pl-c1">&amp;</span><span class="pl-c1">'</span><span class="pl-ent">a</span> <span class="pl-smi">Data</span><span class="pl-kos">&gt;</span><span class="pl-kos">&gt;</span>
<span class="pl-kos">}</span>

<span class="pl-k">type</span> <span class="pl-smi">ValuesIter</span><span class="pl-kos">&lt;</span><span class="pl-c1">'</span><span class="pl-ent">a</span><span class="pl-kos">&gt;</span> = <span class="pl-smi">Box</span><span class="pl-kos">&lt;</span><span class="pl-smi">Iterator</span><span class="pl-kos">&lt;</span><span class="pl-smi">Item</span>=<span class="pl-c1">&amp;</span><span class="pl-c1">'</span><span class="pl-ent">a</span> <span class="pl-smi">Data</span><span class="pl-kos">&gt;</span><span class="pl-kos">&gt;</span><span class="pl-kos">;</span>

<span class="pl-k">impl</span> <span class="pl-kos">&lt;</span><span class="pl-c1">'</span><span class="pl-ent">a</span><span class="pl-kos">&gt;</span> <span class="pl-smi">Values</span><span class="pl-kos">&lt;</span><span class="pl-c1">'</span><span class="pl-ent">a</span><span class="pl-kos">&gt;</span> <span class="pl-kos">{</span>
  <span class="pl-c">// fn use_iter(consume_iter: ValuesIter&lt;'a&gt;) -&gt; Values {  // non cashing version</span>
  <span class="pl-k">fn</span> <span class="pl-en">use_iter</span><span class="pl-kos">(</span><span class="pl-s1">consume_iter</span><span class="pl-kos">:</span> <span class="pl-smi">ValuesIter</span><span class="pl-kos">)</span> -&gt; <span class="pl-smi">Values</span> <span class="pl-kos">{</span>
    <span class="pl-smi">Values</span> <span class="pl-kos">{</span>
      <span class="pl-c1">iter</span><span class="pl-kos">:</span> consume_iter
    <span class="pl-kos">}</span>
  <span class="pl-kos">}</span>
<span class="pl-kos">}</span>



<span class="pl-k">fn</span> <span class="pl-en">main</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 --version --verbose
rustc 1.0.0-nightly (b47aebe3f 2015-02-26) (built 2015-02-26)
binary: rustc
commit-hash: b47aebe3fc2da06c760fd8ea19f84cbc41d34831
commit-date: 2015-02-26
build-date: 2015-02-26
host: x86_64-apple-darwin
release: 1.0.0-nightly"><pre class="notranslate"><code class="notranslate">rustc --version --verbose
rustc 1.0.0-nightly (b47aebe3f 2015-02-26) (built 2015-02-26)
binary: rustc
commit-hash: b47aebe3fc2da06c760fd8ea19f84cbc41d34831
commit-date: 2015-02-26
build-date: 2015-02-26
host: x86_64-apple-darwin
release: 1.0.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="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.has_escaping_regions()', /Users/rustbuild/src/rust-buildbot/slave/nightly-dist-rustc-mac/build/src/librustc/middle/ty.rs:1964

stack backtrace:
   1:          0x849d0f3 - sys::backtrace::write::h0c33dfca8f99823a7hA
   2:          0x84ca075 - panicking::on_panic::h63c237d7347b7375J0I
   3:          0x83f3888 - rt::unwind::begin_unwind_inner::h6bff9e2dc073eba1FJI
   4:          0x5184995 - rt::unwind::begin_unwind::h5603377685902845039
   5:          0x553bff0 - middle::traits::util::predicate_for_trait_ref::hc8b0e37ad45b6f00foT
   6:          0x54f4e9e - middle::traits::util::predicate_for_builtin_bound::h062017d79fea07a3ppT
   7:          0x537bd92 - middle::traits::fulfill::FulfillmentContext&lt;'tcx&gt;::register_builtin_bound::hfa096c6e6360d4a1sJN
   8:          0x4cf17a0 - check::FnCtxt&lt;'a, 'tcx&gt;::register_builtin_bound::h65b7bd738a5caf6cOJo
   9:          0x4d927c5 - check::check_fn::hcd6c5b82200e8b638kn
  10:          0x4dadbe1 - check::check_bare_fn::h15cf7ff47fb8abd6Oan
  11:          0x4db1984 - check::check_method_body::h2c61d934ba5574ddnIn
  12:          0x4da7305 - check::check_item::hdf505d0347935dc1stn
  13:          0x4e76fc3 - check_crate::closure.36015
  14:          0x4e72351 - check_crate::hcb2bf169ea38b50bEXB
  15:          0x47f58fb - driver::phase_3_run_analysis_passes::ha7dff75b48821bd6wFa
  16:          0x47daf31 - driver::compile_input::hae2a48b9668b0aa2Hba
  17:          0x48af037 - run_compiler::h299009668b50e3c8E5b
  18:          0x48ac4b1 - thunk::F.Invoke&lt;A, R&gt;::invoke::h1418038354819973823
  19:          0x48ab110 - rt::unwind::try::try_fn::h5455690823431792689
  20:          0x8542e29 - rust_try_inner
  21:          0x8542e16 - rust_try
  22:          0x48ab875 - thunk::F.Invoke&lt;A, R&gt;::invoke::h5089518861878639055
  23:          0x84b3453 - sys::thread::thread_start::h15d3d9d95ad88a69NDE
  24:         0x917db268 - _pthread_body
  25:         0x917db1e5 - _pthread_body
"><pre class="notranslate"><code class="notranslate">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.has_escaping_regions()', /Users/rustbuild/src/rust-buildbot/slave/nightly-dist-rustc-mac/build/src/librustc/middle/ty.rs:1964

stack backtrace:
   1:          0x849d0f3 - sys::backtrace::write::h0c33dfca8f99823a7hA
   2:          0x84ca075 - panicking::on_panic::h63c237d7347b7375J0I
   3:          0x83f3888 - rt::unwind::begin_unwind_inner::h6bff9e2dc073eba1FJI
   4:          0x5184995 - rt::unwind::begin_unwind::h5603377685902845039
   5:          0x553bff0 - middle::traits::util::predicate_for_trait_ref::hc8b0e37ad45b6f00foT
   6:          0x54f4e9e - middle::traits::util::predicate_for_builtin_bound::h062017d79fea07a3ppT
   7:          0x537bd92 - middle::traits::fulfill::FulfillmentContext&lt;'tcx&gt;::register_builtin_bound::hfa096c6e6360d4a1sJN
   8:          0x4cf17a0 - check::FnCtxt&lt;'a, 'tcx&gt;::register_builtin_bound::h65b7bd738a5caf6cOJo
   9:          0x4d927c5 - check::check_fn::hcd6c5b82200e8b638kn
  10:          0x4dadbe1 - check::check_bare_fn::h15cf7ff47fb8abd6Oan
  11:          0x4db1984 - check::check_method_body::h2c61d934ba5574ddnIn
  12:          0x4da7305 - check::check_item::hdf505d0347935dc1stn
  13:          0x4e76fc3 - check_crate::closure.36015
  14:          0x4e72351 - check_crate::hcb2bf169ea38b50bEXB
  15:          0x47f58fb - driver::phase_3_run_analysis_passes::ha7dff75b48821bd6wFa
  16:          0x47daf31 - driver::compile_input::hae2a48b9668b0aa2Hba
  17:          0x48af037 - run_compiler::h299009668b50e3c8E5b
  18:          0x48ac4b1 - thunk::F.Invoke&lt;A, R&gt;::invoke::h1418038354819973823
  19:          0x48ab110 - rt::unwind::try::try_fn::h5455690823431792689
  20:          0x8542e29 - rust_try_inner
  21:          0x8542e16 - rust_try
  22:          0x48ab875 - thunk::F.Invoke&lt;A, R&gt;::invoke::h5089518861878639055
  23:          0x84b3453 - sys::thread::thread_start::h15d3d9d95ad88a69NDE
  24:         0x917db268 - _pthread_body
  25:         0x917db1e5 - _pthread_body

</code></pre></div>
<p dir="auto">Compiler panic. Found an ealier issue in the same file that had been closed because the problem had gone away in later compiles. This is the stable 1.1 though.</p>
<p dir="auto"><b>Version info</b><br>
rustc 1.1.0 (<a class="commit-link" data-hovercard-type="commit" data-hovercard-url="https://github.com/rust-lang/rust/commit/35ceea3997c79a3b7562e89b462ab76af5b86b22/hovercard" href="https://github.com/rust-lang/rust/commit/35ceea3997c79a3b7562e89b462ab76af5b86b22"><tt>35ceea3</tt></a> 2015-06-19)<br>
binary: rustc<br>
commit-hash: <a class="commit-link" data-hovercard-type="commit" data-hovercard-url="https://github.com/rust-lang/rust/commit/35ceea3997c79a3b7562e89b462ab76af5b86b22/hovercard" href="https://github.com/rust-lang/rust/commit/35ceea3997c79a3b7562e89b462ab76af5b86b22"><tt>35ceea3</tt></a><br>
commit-date: 2015-06-19<br>
host: x86_64-pc-windows-gnu<br>
release: 1.1.0</p>
<p dir="auto"><b>RUST_BACKTRACE=1 rustc --verbose src/main.rs</b><br>
error: internal compiler error: unexpected panic<br>
note: the compiler unexpectedly panicked. this is a bug.<br>
note: we would appreciate a bug report: <a href="https://github.com/rust-lang/rust/blob/master/CONTRIBUTING.md#bug-reports">https://github.com/rust-lang/rust/blob/master/CONTRIBUTING.md#bug-reports</a><br>
note: run with <code class="notranslate">RUST_BACKTRACE=1</code> for a backtrace<br>
thread 'rustc' panicked at 'assertion failed: !self.has_escaping_regions()', C:/bot/slave/stable-dist-rustc-win-gnu-64/build/src/librustc\middle\ty.rs:2123</p>
<p dir="auto">stack backtrace:<br>
1:         0x6f138a02 - sys::backtrace::write::hb142593d131303b10fs<br>
2:         0x6f141e76 - rt::unwind::register::h2f2891f465b0e536sNv<br>
3:         0x6f1053c0 - rt::unwind::begin_unwind_inner::he5d025d7f655ecaaCKv<br>
4:         0x6d08989e - middle::astencode::rbml..Doc&lt;'a&gt;.doc_decoder_helpers::opt_child::hd6aba4d7b00f0fc9UKb<br>
5:         0x6d1c0773 - middle::traits::fulfill::FulfillmentContext&lt;'tcx&gt;::register_builtin_bound::h1fba927ecfad50a9DEO<br>
6:         0x6a93c978 - check::FnCtxt&lt;'a, 'tcx&gt;.mc..Typer&lt;'tcx&gt;::is_method_call::hb206e83d494db5a0Akn<br>
7:         0x6a948ac8 - check::FnCtxt&lt;'a, 'tcx&gt;.AstConv&lt;'tcx&gt;::projected_ty::he778b71de0699925wAo<br>
8:         0x6a95effc - check::CheckItemBodiesVisitor&lt;'a, 'tcx&gt;.Visitor&lt;'tcx&gt;::visit_item::h49b5aaa3aec9c80dWrn<br>
9:         0x6a95d1df - check::CheckItemBodiesVisitor&lt;'a, 'tcx&gt;.Visitor&lt;'tcx&gt;::visit_item::h49b5aaa3aec9c80dWrn<br>
10:         0x6aa187ab - check_crate::hf98f1f239eb0b1afsJC<br>
11:         0x6aa11f75 - check_crate::hf98f1f239eb0b1afsJC<br>
12:         0x6701f3dd - driver::phase_3_run_analysis_passes::h5d9dbc988e0fcdbatGa<br>
13:         0x67002b40 - driver::compile_input::h66ba80b489f2ef28Qba<br>
14:         0x670b5913 - run_compiler::hf1308c7d75cfa1a775b<br>
15:         0x670b349f - run::h99d8d2bce2d42189N5b<br>
16:         0x670b2a59 - run::h99d8d2bce2d42189N5b<br>
17:         0x6f17b5bc - rust_try<br>
18:         0x6f17b599 - rust_try<br>
19:         0x670b2cd5 - run::h99d8d2bce2d42189N5b<br>
20:         0x6f140134 - sys::process::Command::cwd::hecbd2393e1ca7c52luu<br>
21:         0x776659cd - BaseThreadInitThunk</p>