<p dir="auto">Compiling this small snippet</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="enum Expression {
    Symbol(~str),
    Compound(~str, ~[Expression])
}

fn standard_form(expr: &amp;Expression) -&gt; ~str {
    match (*expr) {
        Compound(~&quot;List&quot;, ref items) =&gt; ~&quot;list&quot;,

        Compound(~&quot;Blank&quot;, []) =&gt; ~&quot;_&quot;,

        _ =&gt; ~&quot;default&quot;
    }
}

fn main() {
    let x = ~Symbol(~&quot;x&quot;);
    println(standard_form(x));
}"><pre lang=".rs" class="notranslate"><code class="notranslate">enum Expression {
    Symbol(~str),
    Compound(~str, ~[Expression])
}

fn standard_form(expr: &amp;Expression) -&gt; ~str {
    match (*expr) {
        Compound(~"List", ref items) =&gt; ~"list",

        Compound(~"Blank", []) =&gt; ~"_",

        _ =&gt; ~"default"
    }
}

fn main() {
    let x = ~Symbol(~"x");
    println(standard_form(x));
}
</code></pre></div>
<p dir="auto">yields the following error</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="error: internal compiler error: sequence_element_type called on non-sequence value
This message reflects a bug in the Rust compiler. 
We would appreciate a bug report: https://github.com/mozilla/rust/wiki/HOWTO-submit-a-Rust-bug-report
task 'rustc' failed at 'explicit failure', /var/tmp/portage/dev-lang/rust-9999/work/rust-9999/src/libsyntax/diagnostic.rs:102
task '&lt;main&gt;' failed at 'explicit failure', /var/tmp/portage/dev-lang/rust-9999/work/rust-9999/src/librustc/lib.rs:394"><pre class="notranslate"><code class="notranslate">error: internal compiler error: sequence_element_type called on non-sequence value
This message reflects a bug in the Rust compiler. 
We would appreciate a bug report: https://github.com/mozilla/rust/wiki/HOWTO-submit-a-Rust-bug-report
task 'rustc' failed at 'explicit failure', /var/tmp/portage/dev-lang/rust-9999/work/rust-9999/src/libsyntax/diagnostic.rs:102
task '&lt;main&gt;' failed at 'explicit failure', /var/tmp/portage/dev-lang/rust-9999/work/rust-9999/src/librustc/lib.rs:394
</code></pre></div>
<p dir="auto">Swapping the order of the List and Blank cases makes the error go away. This might be a duplicate of Issue <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="17085643" data-permission-text="Title is private" data-url="https://github.com/rust-lang/rust/issues/7990" data-hovercard-type="issue" data-hovercard-url="/rust-lang/rust/issues/7990/hovercard" href="https://github.com/rust-lang/rust/issues/7990">#7990</a>, but the code there that elicits this is so different I thought it'd be worthwhile to open a whole new issue.</p>
<p dir="auto">If you try to compile <code class="notranslate">tag list&lt;T&gt; { nil; cons(int, list&lt;T&gt;); }</code> (note "list" instead of "<a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/list/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://github.com/list">@list</a>" in the recursive constructor), then the compiler crashes with <code class="notranslate">rt: e2b5:0x00000000:                  Out of stack space, sorry</code>.</p>
<p dir="auto">It would be nice to detect this condition and provide a more useful error message instead.</p>
<p dir="auto">The bottom of the stack is:</p>
<pre class="notranslate">#24545 0x080ff28e in middle::ty::type_structurally_contains::_5f3ac45ea1b71c45 ()
#24546 0x080ff28e in middle::ty::type_structurally_contains::_5f3ac45ea1b71c45 ()
#24547 0x080ff28e in middle::ty::type_structurally_contains::_5f3ac45ea1b71c45 ()
#24548 0x080ff28e in middle::ty::type_structurally_contains::_5f3ac45ea1b71c45 ()
#24549 0x080ff28e in middle::ty::type_structurally_contains::_5f3ac45ea1b71c45 ()
#24550 0x080ff28e in middle::ty::type_structurally_contains::_5f3ac45ea1b71c45 ()
#24551 0x08061feb in middle::trans::type_of_tag::_a125eb2fba6a34ee ()
#24552 0x08061522 in middle::trans::type_of_inner::_f9908926438f2236 ()
#24553 0x080603bb in middle::trans::type_of_fn::_d1c7c2dc9390d6d7 ()
#24554 0x08060a5e in middle::trans::type_of_fn_from_ty::_e121377dba6b8bd0 ()
#24555 0x080bc50c in middle::trans::register_fn_full::_3897f5c49d271367 ()
#24556 0x080bc358 in middle::trans::register_fn::_2c73ab4a26be7a7a ()
#24557 0x080c2fd1 in middle::trans::collect_tag_ctor::_5ff72ae6ae3153d1 ()
#24558 0x082a833e in middle::trans::collect_tag_ctors::thunk1669 ()
#24559 0x082c9589 in syntax::visit::default_visitor::thunk5653 ()
#24560 0x080c354b in middle::trans::collect_tag_ctors::_ec22d712145eb498 ()
#24561 0x080c9503 in middle::trans::trans_crate::_19245ca61421d176 ()
#24562 0x082e809b in driver::rustc::compile_input::thunk8685 ()
#24563 0x0827812d in driver::rustc::time::_8bcb4789e2c2f57e ()
#24564 0x0827acff in driver::rustc::compile_input::_c6e994438f359ee8 ()
#24565 0x08286208 in driver::rustc::main::_ed54e060591e3a31 ()
#24566 0x08286e93 in _rust_main ()
#24567 0x082eb12c in _rust_main_wrap ()
#24568 0x01337321 in task_start_wrapper (a=0xb7fe0010) at ../src/rt/rust_task.cpp:150
#24569 0xdeadbeef in ?? ()
#24570 0xb7fe0010 in ?? ()
#24571 0x00000010 in ?? ()
</pre>