<p dir="auto">This code causes an ICE:</p>
<div class="highlight highlight-source-rust notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="fn main() {
    println!(&quot;x&quot;);
    return;
    let test = if x() { 1 } else { 2 };
}

fn x() -&gt; bool { unreachable!() }"><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-en">println</span><span class="pl-en">!</span><span class="pl-kos">(</span><span class="pl-s">"x"</span><span class="pl-kos">)</span><span class="pl-kos">;</span>
    <span class="pl-k">return</span><span class="pl-kos">;</span>
    <span class="pl-k">let</span> test = <span class="pl-k">if</span> <span class="pl-en">x</span><span class="pl-kos">(</span><span class="pl-kos">)</span> <span class="pl-kos">{</span> <span class="pl-c1">1</span> <span class="pl-kos">}</span> <span class="pl-k">else</span> <span class="pl-kos">{</span> <span class="pl-c1">2</span> <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">x</span><span class="pl-kos">(</span><span class="pl-kos">)</span> -&gt; <span class="pl-smi">bool</span> <span class="pl-kos">{</span> <span class="pl-en">unreachable</span><span class="pl-en">!</span><span class="pl-kos">(</span><span class="pl-kos">)</span> <span class="pl-kos">}</span></pre></div>
<p dir="auto">complaining that the the <code class="notranslate">test</code> variable isn't an alloca. This is true, since we don't output any LLVM IR for unreachable code, which is everything after the <code class="notranslate">return</code>. For some reason, this only happens with <code class="notranslate">if</code> expressions (or at least, it doesn't happen with plain expressions or ordinary blocks) on the RHS.</p>
<p dir="auto">error: internal compiler error: debuginfo::create_local_var_metadata() - Referenced variable location is not an alloca!<br>
Test.rs:131       let take = if num_items &lt;= split_by {<br>
^~~~<br>
note: the compiler unexpectedly panicked. this is a bug.<br>
note: we would appreciate a bug report: <a href="http://doc.rust-lang.org/complement-bugreport.html" rel="nofollow">http://doc.rust-lang.org/complement-bugreport.html</a><br>
note: run with <code class="notranslate">RUST_BACKTRACE=1</code> for a backtrace<br>
thread 'rustc' panicked at 'Box', C:\bot\slave\nightly-dist-rustc-win-64\build\src\libsyntax\diagnostic.rs:130</p>