<p dir="auto">The following code makes rustc core dump. It is hardly a normal use case, but it would be nice if rustc failed more gracefully.</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="$ cat main.rs
#![no_std]
#![feature(box_syntax)]
#![feature(lang_items)]

extern crate core;

use core::ptr::Unique;

#[lang=&quot;owned_box&quot;]
pub struct Box&lt;T&gt;(Unique&lt;T&gt;);

#[lang=&quot;start&quot;]
fn main() {
    let mut test:[isize;1] = [0;1];
    let a = box 5;
    test[*a] = 0;
}

#[lang = &quot;stack_exhausted&quot;] extern fn stack_exhausted() {}
#[lang = &quot;eh_personality&quot;] extern fn eh_personality() {}
#[lang = &quot;panic_fmt&quot;] fn panic_fmt() -&gt; ! { loop{} }"><pre class="notranslate"><code class="notranslate">$ cat main.rs
#![no_std]
#![feature(box_syntax)]
#![feature(lang_items)]

extern crate core;

use core::ptr::Unique;

#[lang="owned_box"]
pub struct Box&lt;T&gt;(Unique&lt;T&gt;);

#[lang="start"]
fn main() {
    let mut test:[isize;1] = [0;1];
    let a = box 5;
    test[*a] = 0;
}

#[lang = "stack_exhausted"] extern fn stack_exhausted() {}
#[lang = "eh_personality"] extern fn eh_personality() {}
#[lang = "panic_fmt"] fn panic_fmt() -&gt; ! { loop{} }
</code></pre></div>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="$ rustc main.rs
main.rs:5:1: 5:19 warning: use of unstable item, #[warn(unstable)] on by default
main.rs:5 extern crate core;
          ^~~~~~~~~~~~~~~~~~

thread 'rustc' has overflowed its stack
Illegal instruction (core dumped)"><pre class="notranslate"><code class="notranslate">$ rustc main.rs
main.rs:5:1: 5:19 warning: use of unstable item, #[warn(unstable)] on by default
main.rs:5 extern crate core;
          ^~~~~~~~~~~~~~~~~~

thread 'rustc' has overflowed its stack
Illegal instruction (core dumped)
</code></pre></div>
<p dir="auto">I’m playing with making a bare-metal executable in rust. I fully admit to not knowing what I’m doing, but I thought this was worth reporting given that it resulted in a stack overflow in rustc. This was produced with the rust nightly from 2014/1/10. I’m on OS X 10.10.1 and installed rustc from the OS X .pkg flle.</p>
<p dir="auto">Here’s how I invoked the compiler:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="$ rustc spin.rs
spin.rs:4:1: 4:19 warning: use of unstable item, #[warn(unstable)] on by default
spin.rs:4 extern crate core;
          ^~~~~~~~~~~~~~~~~~

thread 'rustc' has overflowed its stack
Illegal instruction: 4"><pre class="notranslate"><code class="notranslate">$ rustc spin.rs
spin.rs:4:1: 4:19 warning: use of unstable item, #[warn(unstable)] on by default
spin.rs:4 extern crate core;
          ^~~~~~~~~~~~~~~~~~

thread 'rustc' has overflowed its stack
Illegal instruction: 4
</code></pre></div>
<p dir="auto">Here’s spin.rs:</p>
<div class="highlight highlight-source-rust notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="#![feature(lang_items)]
#![no_std]

extern crate core;

use core::fmt::Arguments;

#[lang=&quot;stack_exhausted&quot;]
extern fn stack_exhausted() {}

#[lang=&quot;eh_personality&quot;]
extern fn eh_personality() {}

#[lang=&quot;begin_unwind&quot;]
extern fn begin_unwind() {}

#[lang=&quot;panic_fmt&quot;]
pub fn panic_fmt(_fmt: &amp;Arguments, _file_line: &amp;(&amp;'static str, usize)) -&gt; ! {
  loop { }
}

#[lang=&quot;start&quot;]
fn main() {
    loop {
    }
}"><pre class="notranslate"><span class="pl-c1">#!<span class="pl-kos">[</span>feature<span class="pl-kos">(</span>lang_items<span class="pl-kos">)</span><span class="pl-kos">]</span></span>
<span class="pl-c1">#!<span class="pl-kos">[</span>no_std<span class="pl-kos">]</span></span>

<span class="pl-k">extern</span> <span class="pl-k">crate</span> core<span class="pl-kos">;</span>

<span class="pl-k">use</span> core<span class="pl-kos">::</span>fmt<span class="pl-kos">::</span><span class="pl-v">Arguments</span><span class="pl-kos">;</span>

<span class="pl-c1">#<span class="pl-kos">[</span>lang=<span class="pl-s">"stack_exhausted"</span><span class="pl-kos">]</span></span>
<span class="pl-k">extern</span> <span class="pl-k">fn</span> <span class="pl-en">stack_exhausted</span><span class="pl-kos">(</span><span class="pl-kos">)</span> <span class="pl-kos">{</span><span class="pl-kos">}</span>

<span class="pl-c1">#<span class="pl-kos">[</span>lang=<span class="pl-s">"eh_personality"</span><span class="pl-kos">]</span></span>
<span class="pl-k">extern</span> <span class="pl-k">fn</span> <span class="pl-en">eh_personality</span><span class="pl-kos">(</span><span class="pl-kos">)</span> <span class="pl-kos">{</span><span class="pl-kos">}</span>

<span class="pl-c1">#<span class="pl-kos">[</span>lang=<span class="pl-s">"begin_unwind"</span><span class="pl-kos">]</span></span>
<span class="pl-k">extern</span> <span class="pl-k">fn</span> <span class="pl-en">begin_unwind</span><span class="pl-kos">(</span><span class="pl-kos">)</span> <span class="pl-kos">{</span><span class="pl-kos">}</span>

<span class="pl-c1">#<span class="pl-kos">[</span>lang=<span class="pl-s">"panic_fmt"</span><span class="pl-kos">]</span></span>
<span class="pl-k">pub</span> <span class="pl-k">fn</span> <span class="pl-en">panic_fmt</span><span class="pl-kos">(</span><span class="pl-s1">_fmt</span><span class="pl-kos">:</span> <span class="pl-c1">&amp;</span><span class="pl-smi">Arguments</span><span class="pl-kos">,</span> <span class="pl-s1">_file_line</span><span class="pl-kos">:</span> <span class="pl-c1">&amp;</span><span class="pl-kos">(</span><span class="pl-c1">&amp;</span><span class="pl-c1">'</span><span class="pl-ent">static</span> <span class="pl-smi">str</span><span class="pl-kos">,</span> <span class="pl-smi">usize</span><span class="pl-kos">)</span><span class="pl-kos">)</span> -&gt; ! <span class="pl-kos">{</span>
  <span class="pl-k">loop</span> <span class="pl-kos">{</span> <span class="pl-kos">}</span>
<span class="pl-kos">}</span>

<span class="pl-c1">#<span class="pl-kos">[</span>lang=<span class="pl-s">"start"</span><span class="pl-kos">]</span></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-k">loop</span> <span class="pl-kos">{</span>
    <span class="pl-kos">}</span>
<span class="pl-kos">}</span></pre></div>