<p dir="auto">The following code currently produces an ICE:</p>
<div class="highlight highlight-source-rust notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="fn main() {
    let bytes = [1u8, 2, 3, 4, 5, 6, 7, 8];

    for [a, b, c, d] in bytes.chunks(4) {
        println!(&quot;{} {} {} {}&quot;, a, b, c, d);
    }
}"><pre class="notranslate"><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-k">let</span> bytes = <span class="pl-kos">[</span><span class="pl-c1">1u8</span><span class="pl-kos">,</span> <span class="pl-c1">2</span><span class="pl-kos">,</span> <span class="pl-c1">3</span><span class="pl-kos">,</span> <span class="pl-c1">4</span><span class="pl-kos">,</span> <span class="pl-c1">5</span><span class="pl-kos">,</span> <span class="pl-c1">6</span><span class="pl-kos">,</span> <span class="pl-c1">7</span><span class="pl-kos">,</span> <span class="pl-c1">8</span><span class="pl-kos">]</span><span class="pl-kos">;</span>

    <span class="pl-k">for</span> <span class="pl-kos">[</span>a<span class="pl-kos">,</span> b<span class="pl-kos">,</span> c<span class="pl-kos">,</span> d<span class="pl-kos">]</span> <span class="pl-k">in</span> bytes<span class="pl-kos">.</span><span class="pl-en">chunks</span><span class="pl-kos">(</span><span class="pl-c1">4</span><span class="pl-kos">)</span> <span class="pl-kos">{</span>
        <span class="pl-en">println</span><span class="pl-en">!</span><span class="pl-kos">(</span><span class="pl-s">"{} {} {} {}"</span>, a, b, c, d<span class="pl-kos">)</span><span class="pl-kos">;</span>
    <span class="pl-kos">}</span>
<span class="pl-kos">}</span></pre></div>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="&lt;anon&gt;:4:9: 4:21 error: internal compiler error: Explicit index of non-index type `core::slice::Chunks&lt;'_,u8&gt;`
&lt;anon&gt;:4     for [a, b, c, d] in bytes.chunks(4) {
                 ^~~~~~~~~~~~
note: the compiler hit an unexpected failure path. this is a bug.
note: we would appreciate a bug report: http://doc.rust-lang.org/complement-bugreport.html
note: run with `RUST_BACKTRACE=1` for a backtrace
task 'rustc' failed at 'Box&lt;Any&gt;', /build/rust-git/src/rust/src/libsyntax/diagnostic.rs:113"><pre class="notranslate"><code class="notranslate">&lt;anon&gt;:4:9: 4:21 error: internal compiler error: Explicit index of non-index type `core::slice::Chunks&lt;'_,u8&gt;`
&lt;anon&gt;:4     for [a, b, c, d] in bytes.chunks(4) {
                 ^~~~~~~~~~~~
note: the compiler hit an unexpected failure path. this is a bug.
note: we would appreciate a bug report: http://doc.rust-lang.org/complement-bugreport.html
note: run with `RUST_BACKTRACE=1` for a backtrace
task 'rustc' failed at 'Box&lt;Any&gt;', /build/rust-git/src/rust/src/libsyntax/diagnostic.rs:113
</code></pre></div>
<p dir="auto">This should clearly produce a compile time error of course, but not an ICE.</p>
<p dir="auto">The following code</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="struct Wrapper&lt;'a&gt; {
    slice: &amp;'a [u8]
}

fn main() {
    let foo = Some(b&quot;Hello World!&quot;);
    let bar: Option&lt;Wrapper&lt;'static&gt;&gt; = foo.map(|&amp;x| Wrapper { slice: x });


}"><pre class="notranslate"><code class="notranslate">struct Wrapper&lt;'a&gt; {
    slice: &amp;'a [u8]
}

fn main() {
    let foo = Some(b"Hello World!");
    let bar: Option&lt;Wrapper&lt;'static&gt;&gt; = foo.map(|&amp;x| Wrapper { slice: x });


}
</code></pre></div>
<p dir="auto">triggers a compiler bug:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="$ RUST_BACKTRACE=1 rustc test.rs 
test.rs:7:71: 7:72 error: internal compiler error: Explicit index of non-index type `[u8]`
test.rs:7     let bar: Option&lt;Wrapper&lt;'static&gt;&gt; = foo.map(|&amp;x| Wrapper { slice: x });
                                                                                ^
note: the compiler hit an unexpected failure path. this is a bug.
note: we would appreciate a bug report: http://doc.rust-lang.org/complement-bugreport.html
note: run with `RUST_BACKTRACE=1` for a backtrace
task 'rustc' failed at 'Box&lt;Any&gt;', /Users/rustbuild/src/rust-buildbot/slave/nightly-mac/build/src/libsyntax/diagnostic.rs:107

stack backtrace:
   1:        0x10753a635 - rt::backtrace::imp::write::hbede6c694eb9f2cbIQp::v0.11.0.pre
   2:        0x107540bd7 - failure::on_fail::h30a7f46ec21fe35516p::v0.11.0.pre
   3:        0x1077eb249 - unwind::begin_unwind_inner::h6c751dc42f0f7f17IVd::v0.11.0.pre
   4:        0x106c51e25 - unwind::begin_unwind::h16840659320017284217::v0.11.0.pre
   5:        0x106c51dad - diagnostic::SpanHandler::span_bug::hb5a406cf5dd1450cWac::v0.11.0.pre
   6:        0x1045047e5 - driver::session::Session::span_bug::hc60df83bd7dbe984Trr::v0.11.0.pre
   7:        0x10478c506 - middle::mem_categorization::MemCategorizationContext&lt;'t, TYPER&gt;::cat_index::h11027325414672250850::v0.11.0.pre
   8:        0x10476be2b - middle::typeck::check::regionck::visit_expr::h8ad96e881d8c059afH8::v0.11.0.pre
   9:        0x104770542 - visit::walk_expr::h7092108895728945809::v0.11.0.pre
  10:        0x10476b2a0 - middle::typeck::check::regionck::visit_expr::h8ad96e881d8c059afH8::v0.11.0.pre
  11:        0x10476cf8e - visit::walk_block::h6655035168579021138::v0.11.0.pre
  12:        0x104770936 - visit::walk_fn::h7111590603532843168::v0.11.0.pre
  13:        0x10476b865 - middle::typeck::check::regionck::visit_expr::h8ad96e881d8c059afH8::v0.11.0.pre
  14:        0x104770113 - visit::walk_expr::h7092108895728945809::v0.11.0.pre
  15:        0x10476b2a0 - middle::typeck::check::regionck::visit_expr::h8ad96e881d8c059afH8::v0.11.0.pre
  16:        0x10476ce12 - middle::typeck::check::regionck::visit_local::ha0697ea4d5b15fbeUD8::v0.11.0.pre
  17:        0x10476cf6a - visit::walk_block::h6655035168579021138::v0.11.0.pre
  18:        0x1047afc0e - middle::typeck::check::check_bare_fn::hcd02e3ea22711cdcA2c::v0.11.0.pre
  19:        0x1047a98ce - middle::typeck::check::check_item::h066c89136b0abe5fOzd::v0.11.0.pre
  20:        0x1047af98d - middle::typeck::check::check_item_types::ha45c368daeab74efS1c::v0.11.0.pre
  21:        0x10492161e - middle::typeck::check_crate::hae37e3b7b5c6e1b3Q3C::v0.11.0.pre
  22:        0x104d75878 - driver::driver::phase_3_run_analysis_passes::hfbfa07100b0674bdFrq::v0.11.0.pre
  23:        0x104d708c5 - driver::driver::compile_input::hf1aa489ba45a9efcDeq::v0.11.0.pre
  24:        0x104e3709b - driver::run_compiler::h9c79a8fc68073767b0s::v0.11.0.pre
  25:        0x104e348b6 - driver::main_args::closure.117540
  26:        0x104e48f8b - task::TaskBuilder&lt;S&gt;::try_future::closure.118681
  27:        0x104e48e24 - task::TaskBuilder&lt;S&gt;::spawn_internal::closure.118658
  28:        0x10444395c - task::spawn_opts::closure.7563
  29:        0x107850dac - rust_try
  30:        0x1077e76ea - unwind::try::h7f3fc3b0329b49ea7Jd::v0.11.0.pre
  31:        0x1077e73ec - task::Task::run::h4a0e5408354628dfZVc::v0.11.0.pre
  32:        0x1044437eb - task::spawn_opts::closure.7508
  33:        0x1077e9f59 - thread::thread_start::h5aa600706e7c5c88xid::v0.11.0.pre
  34:     0x7fff973fd899 - _pthread_body
  35:     0x7fff973fd72a - _pthread_struct_init"><pre class="notranslate"><code class="notranslate">$ RUST_BACKTRACE=1 rustc test.rs 
test.rs:7:71: 7:72 error: internal compiler error: Explicit index of non-index type `[u8]`
test.rs:7     let bar: Option&lt;Wrapper&lt;'static&gt;&gt; = foo.map(|&amp;x| Wrapper { slice: x });
                                                                                ^
note: the compiler hit an unexpected failure path. this is a bug.
note: we would appreciate a bug report: http://doc.rust-lang.org/complement-bugreport.html
note: run with `RUST_BACKTRACE=1` for a backtrace
task 'rustc' failed at 'Box&lt;Any&gt;', /Users/rustbuild/src/rust-buildbot/slave/nightly-mac/build/src/libsyntax/diagnostic.rs:107

stack backtrace:
   1:        0x10753a635 - rt::backtrace::imp::write::hbede6c694eb9f2cbIQp::v0.11.0.pre
   2:        0x107540bd7 - failure::on_fail::h30a7f46ec21fe35516p::v0.11.0.pre
   3:        0x1077eb249 - unwind::begin_unwind_inner::h6c751dc42f0f7f17IVd::v0.11.0.pre
   4:        0x106c51e25 - unwind::begin_unwind::h16840659320017284217::v0.11.0.pre
   5:        0x106c51dad - diagnostic::SpanHandler::span_bug::hb5a406cf5dd1450cWac::v0.11.0.pre
   6:        0x1045047e5 - driver::session::Session::span_bug::hc60df83bd7dbe984Trr::v0.11.0.pre
   7:        0x10478c506 - middle::mem_categorization::MemCategorizationContext&lt;'t, TYPER&gt;::cat_index::h11027325414672250850::v0.11.0.pre
   8:        0x10476be2b - middle::typeck::check::regionck::visit_expr::h8ad96e881d8c059afH8::v0.11.0.pre
   9:        0x104770542 - visit::walk_expr::h7092108895728945809::v0.11.0.pre
  10:        0x10476b2a0 - middle::typeck::check::regionck::visit_expr::h8ad96e881d8c059afH8::v0.11.0.pre
  11:        0x10476cf8e - visit::walk_block::h6655035168579021138::v0.11.0.pre
  12:        0x104770936 - visit::walk_fn::h7111590603532843168::v0.11.0.pre
  13:        0x10476b865 - middle::typeck::check::regionck::visit_expr::h8ad96e881d8c059afH8::v0.11.0.pre
  14:        0x104770113 - visit::walk_expr::h7092108895728945809::v0.11.0.pre
  15:        0x10476b2a0 - middle::typeck::check::regionck::visit_expr::h8ad96e881d8c059afH8::v0.11.0.pre
  16:        0x10476ce12 - middle::typeck::check::regionck::visit_local::ha0697ea4d5b15fbeUD8::v0.11.0.pre
  17:        0x10476cf6a - visit::walk_block::h6655035168579021138::v0.11.0.pre
  18:        0x1047afc0e - middle::typeck::check::check_bare_fn::hcd02e3ea22711cdcA2c::v0.11.0.pre
  19:        0x1047a98ce - middle::typeck::check::check_item::h066c89136b0abe5fOzd::v0.11.0.pre
  20:        0x1047af98d - middle::typeck::check::check_item_types::ha45c368daeab74efS1c::v0.11.0.pre
  21:        0x10492161e - middle::typeck::check_crate::hae37e3b7b5c6e1b3Q3C::v0.11.0.pre
  22:        0x104d75878 - driver::driver::phase_3_run_analysis_passes::hfbfa07100b0674bdFrq::v0.11.0.pre
  23:        0x104d708c5 - driver::driver::compile_input::hf1aa489ba45a9efcDeq::v0.11.0.pre
  24:        0x104e3709b - driver::run_compiler::h9c79a8fc68073767b0s::v0.11.0.pre
  25:        0x104e348b6 - driver::main_args::closure.117540
  26:        0x104e48f8b - task::TaskBuilder&lt;S&gt;::try_future::closure.118681
  27:        0x104e48e24 - task::TaskBuilder&lt;S&gt;::spawn_internal::closure.118658
  28:        0x10444395c - task::spawn_opts::closure.7563
  29:        0x107850dac - rust_try
  30:        0x1077e76ea - unwind::try::h7f3fc3b0329b49ea7Jd::v0.11.0.pre
  31:        0x1077e73ec - task::Task::run::h4a0e5408354628dfZVc::v0.11.0.pre
  32:        0x1044437eb - task::spawn_opts::closure.7508
  33:        0x1077e9f59 - thread::thread_start::h5aa600706e7c5c88xid::v0.11.0.pre
  34:     0x7fff973fd899 - _pthread_body
  35:     0x7fff973fd72a - _pthread_struct_init
</code></pre></div>