<p dir="auto">Summary of the bug is in the title</p>
<p dir="auto">I tried with this code :</p>
<div class="highlight highlight-source-rust notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="enum Event {
    ENTRY,
    EXIT,
}

struct Data;

struct State&lt;'a&gt; {
    f: Fn(&amp;mut Data, &amp;Event) -&gt; &amp;'a Signal&lt;'a&gt;,
}

enum Signal&lt;'a&gt; {
    UNHANDLED,
    HANDLED,
    TRAN(Fn(&amp;mut Data, &amp;Event) -&gt; &amp;'a Signal&lt;'a&gt;),
}

struct FSM&lt;'a&gt;  {
    current : Option&lt;&amp;'a State&lt;'a&gt;&gt;,
    data : Data,
}

impl &lt;'a&gt; FSM&lt;'a&gt; {

    pub fn start(&amp;mut self) {
        match self.current {
            None =&gt; panic!(&quot;Ola !&quot;),
            Some(current) =&gt; {(current.f)(&amp;mut self.data, &amp;Event::ENTRY);},
            }

    }

    pub fn event(&amp;mut self,event : Event) {
        let signal = (self.current.unwrap().f)(&amp;mut self.data, &amp;event);
    }

}"><pre class="notranslate"><span class="pl-k">enum</span> <span class="pl-smi">Event</span> <span class="pl-kos">{</span>
    <span class="pl-v">ENTRY</span><span class="pl-kos">,</span>
    <span class="pl-v">EXIT</span><span class="pl-kos">,</span>
<span class="pl-kos">}</span>

<span class="pl-k">struct</span> <span class="pl-smi">Data</span><span class="pl-kos">;</span>

<span class="pl-k">struct</span> <span class="pl-smi">State</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">f</span><span class="pl-kos">:</span> <span class="pl-smi">Fn</span><span class="pl-kos">(</span><span class="pl-c1">&amp;</span><span class="pl-k">mut</span> <span class="pl-smi">Data</span><span class="pl-kos">,</span> <span class="pl-c1">&amp;</span><span class="pl-smi">Event</span><span class="pl-kos">)</span> -&gt; <span class="pl-c1">&amp;</span><span class="pl-c1">'</span><span class="pl-ent">a</span> <span class="pl-smi">Signal</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-kos">}</span>

<span class="pl-k">enum</span> <span class="pl-smi">Signal</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-v">UNHANDLED</span><span class="pl-kos">,</span>
    <span class="pl-v">HANDLED</span><span class="pl-kos">,</span>
    <span class="pl-v">TRAN</span><span class="pl-kos">(</span><span class="pl-smi">Fn</span><span class="pl-kos">(</span><span class="pl-c1">&amp;</span><span class="pl-k">mut</span> <span class="pl-smi">Data</span><span class="pl-kos">,</span> <span class="pl-c1">&amp;</span><span class="pl-smi">Event</span><span class="pl-kos">)</span> -&gt; <span class="pl-c1">&amp;</span><span class="pl-c1">'</span><span class="pl-ent">a</span> <span class="pl-smi">Signal</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-kos">,</span>
<span class="pl-kos">}</span>

<span class="pl-k">struct</span> <span class="pl-smi">FSM</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">current</span> <span class="pl-kos">:</span> <span class="pl-smi">Option</span><span class="pl-kos">&lt;</span><span class="pl-c1">&amp;</span><span class="pl-c1">'</span><span class="pl-ent">a</span> <span class="pl-smi">State</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">&gt;</span><span class="pl-kos">,</span>
    <span class="pl-c1">data</span> <span class="pl-kos">:</span> <span class="pl-smi">Data</span><span class="pl-kos">,</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">FSM</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-k">pub</span> <span class="pl-k">fn</span> <span class="pl-en">start</span><span class="pl-kos">(</span><span class="pl-c1">&amp;</span><span class="pl-k">mut</span> <span class="pl-smi">self</span><span class="pl-kos">)</span> <span class="pl-kos">{</span>
        <span class="pl-k">match</span> <span class="pl-smi">self</span><span class="pl-kos">.</span><span class="pl-c1">current</span> <span class="pl-kos">{</span>
            <span class="pl-v">None</span> =&gt; <span class="pl-en">panic</span><span class="pl-en">!</span><span class="pl-kos">(</span><span class="pl-s">"Ola !"</span><span class="pl-kos">)</span><span class="pl-kos">,</span>
            <span class="pl-v">Some</span><span class="pl-kos">(</span>current<span class="pl-kos">)</span> =&gt; <span class="pl-kos">{</span><span class="pl-kos">(</span>current<span class="pl-kos">.</span><span class="pl-c1">f</span><span class="pl-kos">)</span><span class="pl-kos">(</span><span class="pl-c1">&amp;</span><span class="pl-k">mut</span> <span class="pl-smi">self</span><span class="pl-kos">.</span><span class="pl-c1">data</span><span class="pl-kos">,</span> <span class="pl-c1">&amp;</span><span class="pl-smi">Event</span><span class="pl-kos">::</span><span class="pl-v">ENTRY</span><span class="pl-kos">)</span><span class="pl-kos">;</span><span class="pl-kos">}</span><span class="pl-kos">,</span>
            <span class="pl-kos">}</span>

    <span class="pl-kos">}</span>

    <span class="pl-k">pub</span> <span class="pl-k">fn</span> <span class="pl-en">event</span><span class="pl-kos">(</span><span class="pl-c1">&amp;</span><span class="pl-k">mut</span> <span class="pl-smi">self</span><span class="pl-kos">,</span><span class="pl-s1">event</span> <span class="pl-kos">:</span> <span class="pl-smi">Event</span><span class="pl-kos">)</span> <span class="pl-kos">{</span>
        <span class="pl-k">let</span> signal = <span class="pl-kos">(</span><span class="pl-smi">self</span><span class="pl-kos">.</span><span class="pl-c1">current</span><span class="pl-kos">.</span><span class="pl-en">unwrap</span><span class="pl-kos">(</span><span class="pl-kos">)</span><span class="pl-kos">.</span><span class="pl-c1">f</span><span class="pl-kos">)</span><span class="pl-kos">(</span><span class="pl-c1">&amp;</span><span class="pl-k">mut</span> <span class="pl-smi">self</span><span class="pl-kos">.</span><span class="pl-c1">data</span><span class="pl-kos">,</span> <span class="pl-c1">&amp;</span>event<span class="pl-kos">)</span><span class="pl-kos">;</span>
    <span class="pl-kos">}</span>

<span class="pl-kos">}</span></pre></div>
<p dir="auto">I expected rustc would have kept yelling at me about errors in my code :)<br>
Instead, I get the following output</p>
<div class="highlight highlight-text-shell-session notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="[miK@i5760-miK bug]$ cargo build --verbose
   Compiling hello_world v0.0.1 (file:///home/miK/workspaces/Rust/bug)
     Running `rustc src/lib.rs --crate-name hello_world --crate-type lib -g --out-dir /home/miK/workspaces/Rust/bug/target/debug --emit=dep-info,link -L dependency=/home/miK/workspaces/Rust/bug/target/debug -L dependency=/home/miK/workspaces/Rust/bug/target/debug/deps`
src/lib.rs:2:1: 5:2 warning: enum is never used: `Event`, #[warn(dead_code)] on by default
src/lib.rs:2 enum Event {
src/lib.rs:3     ENTRY,
src/lib.rs:4     EXIT,
src/lib.rs:5 }
src/lib.rs:7:1: 7:13 warning: struct is never used: `Data`, #[warn(dead_code)] on by default
src/lib.rs:7 struct Data;
             ^~~~~~~~~~~~
src/lib.rs:9:1: 11:2 warning: struct is never used: `State`, #[warn(dead_code)] on by default
src/lib.rs:9 struct State&lt;'a&gt; {
src/lib.rs:10     f: Fn(&amp;mut Data, &amp;Event) -&gt; &amp;'a Signal&lt;'a&gt;,
src/lib.rs:11 }
src/lib.rs:13:1: 17:2 warning: enum is never used: `Signal`, #[warn(dead_code)] on by default
src/lib.rs:13 enum Signal&lt;'a&gt; {
src/lib.rs:14     UNHANDLED,
src/lib.rs:15     HANDLED,
src/lib.rs:16     TRAN(Fn(&amp;mut Data, &amp;Event) -&gt; &amp;'a Signal&lt;'a&gt;),
src/lib.rs:17 }
src/lib.rs:19:1: 22:2 warning: struct is never used: `FSM`, #[warn(dead_code)] on by default
src/lib.rs:19 struct FSM&lt;'a&gt;  {
src/lib.rs:20     current : Option&lt;&amp;'a State&lt;'a&gt;&gt;,
src/lib.rs:21     data : Data,
src/lib.rs:22 }
src/lib.rs:20:5: 20:36 warning: struct field is never used: `current`, #[warn(dead_code)] on by default
src/lib.rs:20     current : Option&lt;&amp;'a State&lt;'a&gt;&gt;,
                  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/lib.rs:21:5: 21:16 warning: struct field is never used: `data`, #[warn(dead_code)] on by default
src/lib.rs:21     data : Data,
                  ^~~~~~~~~~~
src/lib.rs:26:5: 32:6 warning: method is never used: `start`, #[warn(dead_code)] on by default
src/lib.rs:26     pub fn start(&amp;mut self) {
src/lib.rs:27         match self.current {
src/lib.rs:28             None =&gt; panic!(&quot;Ola !&quot;),
src/lib.rs:29             Some(current) =&gt; {(current.f)(&amp;mut self.data, &amp;Event::ENTRY);},
src/lib.rs:30             }
src/lib.rs:31         
              ...
src/lib.rs:34:5: 36:6 warning: method is never used: `event`, #[warn(dead_code)] on by default
src/lib.rs:34     pub fn event(&amp;mut self,event : Event) {
src/lib.rs:35         let signal = (self.current.unwrap().f)(&amp;mut self.data, &amp;event);
src/lib.rs:36     }
src/lib.rs:35:13: 35:19 warning: unused variable: `signal`, #[warn(unused_variables)] on by default
src/lib.rs:35         let signal = (self.current.unwrap().f)(&amp;mut self.data, &amp;event);
                          ^~~~~~
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 'Unexpected type returned from struct_tail: Signal for ty=Signal', /home/rustbuild/src/rust-buildbot/slave/stable-dist-rustc-linux/build/src/librustc_trans/trans/type_of.rs:366

stack backtrace:
   1:     0x7f4a6dfdf529 - sys::backtrace::write::ha3b8868b13c6f5b594r
   2:     0x7f4a6dfe7449 - panicking::on_panic::h0d4f0a7bb69824a9iJw
   3:     0x7f4a6dfa8242 - rt::unwind::begin_unwind_inner::h6eae1ff9ccde81e1sow
   4:     0x7f4a6dfa8fd7 - rt::unwind::begin_unwind_fmt::h1b64aa0dc7f97d91ynw
   5:     0x7f4a6cd84041 - trans::type_of::in_memory_type_of::h8394fa8ab4d78a04xNL
   6:     0x7f4a6ce4c42f - trans::type_of::type_of_rust_fn::hd912a43908d09915gBL
   7:     0x7f4a6cd9092b - trans::declare::declare_rust_fn::h9be6db25c327fe6dRNz
   8:     0x7f4a6cea5442 - trans::meth::trans_object_shim::hb599a1c833cfc4e8BwJ
   9:     0x7f4a6cdee7a8 - trans::meth::trans_method_callee::hccc5b8b91d6ac958o2I
  10:     0x7f4a6ce6f845 - trans::callee::trans_call_inner::h3335664676729396018
  11:     0x7f4a6ce4fc13 - trans::expr::trans_rvalue_dps_unadjusted::h6f98c3ba8230a493FkB
  12:     0x7f4a6ce245dc - trans::expr::trans_into::h5caadbac159cf74aXaA
  13:     0x7f4a6ce2414a - trans::controlflow::trans_stmt_semi::h1d1c29c8dbdd3907D2u
  14:     0x7f4a6cda84ba - trans::controlflow::trans_block::he9bca081d3f8c1c7z3u
  15:     0x7f4a6ce4e45d - trans::expr::trans_rvalue_dps_unadjusted::h6f98c3ba8230a493FkB
  16:     0x7f4a6ce245dc - trans::expr::trans_into::h5caadbac159cf74aXaA
  17:     0x7f4a6ce8b007 - trans::_match::trans_match_inner::h57034bb4c897c3296uI
  18:     0x7f4a6ce4e425 - trans::expr::trans_rvalue_dps_unadjusted::h6f98c3ba8230a493FkB
  19:     0x7f4a6ce245dc - trans::expr::trans_into::h5caadbac159cf74aXaA
  20:     0x7f4a6cda8806 - trans::controlflow::trans_block::he9bca081d3f8c1c7z3u
  21:     0x7f4a6cda7121 - trans::base::trans_closure::h502004b16ea01ff9jHh
  22:     0x7f4a6cda8dfa - trans::base::trans_fn::h5f2be6a1df79e5691Rh
  23:     0x7f4a6cdac652 - trans::base::trans_item::hfa0f4f4b559a2855dgi
  24:     0x7f4a6cdb9a32 - trans::base::trans_crate::hf005d8f63d50ea8004i
  25:     0x7f4a6e537466 - driver::phase_4_translate_to_llvm::h86819ae7902c932bnOa
  26:     0x7f4a6e513266 - driver::compile_input::h6e596544d26b4394Qba
  27:     0x7f4a6e5c9041 - run_compiler::haa6c0289fab7415475b
  28:     0x7f4a6e5c6892 - boxed::F.FnBox&lt;A&gt;::call_box::h10721825727138786690
  29:     0x7f4a6e5c5e59 - rt::unwind::try::try_fn::h6014602198652783625
  30:     0x7f4a6e05fb58 - rust_try_inner
  31:     0x7f4a6e05fb45 - rust_try
  32:     0x7f4a6e5c60f4 - boxed::F.FnBox&lt;A&gt;::call_box::h5510246712457526188
  33:     0x7f4a6dfe61e1 - sys::thread::Thread::new::thread_start::h11fbc90f6ba541f9zvv
  34:     0x7f4a68877ee4 - start_thread
  35:     0x7f4a6dc29d1c - clone
  36:                0x0 - &lt;unknown&gt;

Could not compile `hello_world`.

Caused by:
  Process didn't exit successfully: `rustc src/lib.rs --crate-name hello_world --crate-type lib -g --out-dir /home/miK/workspaces/Rust/bug/target/debug --emit=dep-info,link -L dependency=/home/miK/workspaces/Rust/bug/target/debug -L dependency=/home/miK/workspaces/Rust/bug/target/debug/deps` (exit code: 101)"><pre class="notranslate"><span class="pl-e">[miK@i5760-miK bug]</span>$ <span class="pl-s1">cargo build --verbose</span>
<span class="pl-c1">   Compiling hello_world v0.0.1 (file:///home/miK/workspaces/Rust/bug)</span>
<span class="pl-c1">     Running `rustc src/lib.rs --crate-name hello_world --crate-type lib -g --out-dir /home/miK/workspaces/Rust/bug/target/debug --emit=dep-info,link -L dependency=/home/miK/workspaces/Rust/bug/target/debug -L dependency=/home/miK/workspaces/Rust/bug/target/debug/deps`</span>
<span class="pl-c1">src/lib.rs:2:1: 5:2 warning: enum is never used: `Event`, #[warn(dead_code)] on by default</span>
<span class="pl-c1">src/lib.rs:2 enum Event {</span>
<span class="pl-c1">src/lib.rs:3     ENTRY,</span>
<span class="pl-c1">src/lib.rs:4     EXIT,</span>
<span class="pl-c1">src/lib.rs:5 }</span>
<span class="pl-c1">src/lib.rs:7:1: 7:13 warning: struct is never used: `Data`, #[warn(dead_code)] on by default</span>
<span class="pl-c1">src/lib.rs:7 struct Data;</span>
<span class="pl-c1">             ^~~~~~~~~~~~</span>
<span class="pl-c1">src/lib.rs:9:1: 11:2 warning: struct is never used: `State`, #[warn(dead_code)] on by default</span>
<span class="pl-c1">src/lib.rs:9 struct State&lt;'a&gt; {</span>
<span class="pl-c1">src/lib.rs:10     f: Fn(&amp;mut Data, &amp;Event) -&gt; &amp;'a Signal&lt;'a&gt;,</span>
<span class="pl-c1">src/lib.rs:11 }</span>
<span class="pl-c1">src/lib.rs:13:1: 17:2 warning: enum is never used: `Signal`, #[warn(dead_code)] on by default</span>
<span class="pl-c1">src/lib.rs:13 enum Signal&lt;'a&gt; {</span>
<span class="pl-c1">src/lib.rs:14     UNHANDLED,</span>
<span class="pl-c1">src/lib.rs:15     HANDLED,</span>
<span class="pl-c1">src/lib.rs:16     TRAN(Fn(&amp;mut Data, &amp;Event) -&gt; &amp;'a Signal&lt;'a&gt;),</span>
<span class="pl-c1">src/lib.rs:17 }</span>
<span class="pl-c1">src/lib.rs:19:1: 22:2 warning: struct is never used: `FSM`, #[warn(dead_code)] on by default</span>
<span class="pl-c1">src/lib.rs:19 struct FSM&lt;'a&gt;  {</span>
<span class="pl-c1">src/lib.rs:20     current : Option&lt;&amp;'a State&lt;'a&gt;&gt;,</span>
<span class="pl-c1">src/lib.rs:21     data : Data,</span>
<span class="pl-c1">src/lib.rs:22 }</span>
<span class="pl-c1">src/lib.rs:20:5: 20:36 warning: struct field is never used: `current`, #[warn(dead_code)] on by default</span>
<span class="pl-c1">src/lib.rs:20     current : Option&lt;&amp;'a State&lt;'a&gt;&gt;,</span>
<span class="pl-c1">                  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~</span>
<span class="pl-c1">src/lib.rs:21:5: 21:16 warning: struct field is never used: `data`, #[warn(dead_code)] on by default</span>
<span class="pl-c1">src/lib.rs:21     data : Data,</span>
<span class="pl-c1">                  ^~~~~~~~~~~</span>
<span class="pl-c1">src/lib.rs:26:5: 32:6 warning: method is never used: `start`, #[warn(dead_code)] on by default</span>
<span class="pl-c1">src/lib.rs:26     pub fn start(&amp;mut self) {</span>
<span class="pl-c1">src/lib.rs:27         match self.current {</span>
<span class="pl-c1">src/lib.rs:28             None =&gt; panic!("Ola !"),</span>
<span class="pl-c1">src/lib.rs:29             Some(current) =&gt; {(current.f)(&amp;mut self.data, &amp;Event::ENTRY);},</span>
<span class="pl-c1">src/lib.rs:30             }</span>
<span class="pl-c1">src/lib.rs:31         </span>
<span class="pl-c1">              ...</span>
<span class="pl-c1">src/lib.rs:34:5: 36:6 warning: method is never used: `event`, #[warn(dead_code)] on by default</span>
<span class="pl-c1">src/lib.rs:34     pub fn event(&amp;mut self,event : Event) {</span>
<span class="pl-c1">src/lib.rs:35         let signal = (self.current.unwrap().f)(&amp;mut self.data, &amp;event);</span>
<span class="pl-c1">src/lib.rs:36     }</span>
<span class="pl-c1">src/lib.rs:35:13: 35:19 warning: unused variable: `signal`, #[warn(unused_variables)] on by default</span>
<span class="pl-c1">src/lib.rs:35         let signal = (self.current.unwrap().f)(&amp;mut self.data, &amp;event);</span>
<span class="pl-c1">                          ^~~~~~</span>
<span class="pl-c1">error: internal compiler error: unexpected panic</span>
<span class="pl-c1">note: the compiler unexpectedly panicked. this is a bug.</span>
<span class="pl-c1">note: we would appreciate a bug report: https://github.com/rust-lang/rust/blob/master/CONTRIBUTING.md#bug-reports</span>
<span class="pl-c1">note: run with `RUST_BACKTRACE=1` for a backtrace</span>
<span class="pl-c1">thread 'rustc' panicked at 'Unexpected type returned from struct_tail: Signal for ty=Signal', /home/rustbuild/src/rust-buildbot/slave/stable-dist-rustc-linux/build/src/librustc_trans/trans/type_of.rs:366</span>

<span class="pl-c1">stack backtrace:</span>
<span class="pl-c1">   1:     0x7f4a6dfdf529 - sys::backtrace::write::ha3b8868b13c6f5b594r</span>
<span class="pl-c1">   2:     0x7f4a6dfe7449 - panicking::on_panic::h0d4f0a7bb69824a9iJw</span>
<span class="pl-c1">   3:     0x7f4a6dfa8242 - rt::unwind::begin_unwind_inner::h6eae1ff9ccde81e1sow</span>
<span class="pl-c1">   4:     0x7f4a6dfa8fd7 - rt::unwind::begin_unwind_fmt::h1b64aa0dc7f97d91ynw</span>
<span class="pl-c1">   5:     0x7f4a6cd84041 - trans::type_of::in_memory_type_of::h8394fa8ab4d78a04xNL</span>
<span class="pl-c1">   6:     0x7f4a6ce4c42f - trans::type_of::type_of_rust_fn::hd912a43908d09915gBL</span>
<span class="pl-c1">   7:     0x7f4a6cd9092b - trans::declare::declare_rust_fn::h9be6db25c327fe6dRNz</span>
<span class="pl-c1">   8:     0x7f4a6cea5442 - trans::meth::trans_object_shim::hb599a1c833cfc4e8BwJ</span>
<span class="pl-c1">   9:     0x7f4a6cdee7a8 - trans::meth::trans_method_callee::hccc5b8b91d6ac958o2I</span>
<span class="pl-c1">  10:     0x7f4a6ce6f845 - trans::callee::trans_call_inner::h3335664676729396018</span>
<span class="pl-c1">  11:     0x7f4a6ce4fc13 - trans::expr::trans_rvalue_dps_unadjusted::h6f98c3ba8230a493FkB</span>
<span class="pl-c1">  12:     0x7f4a6ce245dc - trans::expr::trans_into::h5caadbac159cf74aXaA</span>
<span class="pl-c1">  13:     0x7f4a6ce2414a - trans::controlflow::trans_stmt_semi::h1d1c29c8dbdd3907D2u</span>
<span class="pl-c1">  14:     0x7f4a6cda84ba - trans::controlflow::trans_block::he9bca081d3f8c1c7z3u</span>
<span class="pl-c1">  15:     0x7f4a6ce4e45d - trans::expr::trans_rvalue_dps_unadjusted::h6f98c3ba8230a493FkB</span>
<span class="pl-c1">  16:     0x7f4a6ce245dc - trans::expr::trans_into::h5caadbac159cf74aXaA</span>
<span class="pl-c1">  17:     0x7f4a6ce8b007 - trans::_match::trans_match_inner::h57034bb4c897c3296uI</span>
<span class="pl-c1">  18:     0x7f4a6ce4e425 - trans::expr::trans_rvalue_dps_unadjusted::h6f98c3ba8230a493FkB</span>
<span class="pl-c1">  19:     0x7f4a6ce245dc - trans::expr::trans_into::h5caadbac159cf74aXaA</span>
<span class="pl-c1">  20:     0x7f4a6cda8806 - trans::controlflow::trans_block::he9bca081d3f8c1c7z3u</span>
<span class="pl-c1">  21:     0x7f4a6cda7121 - trans::base::trans_closure::h502004b16ea01ff9jHh</span>
<span class="pl-c1">  22:     0x7f4a6cda8dfa - trans::base::trans_fn::h5f2be6a1df79e5691Rh</span>
<span class="pl-c1">  23:     0x7f4a6cdac652 - trans::base::trans_item::hfa0f4f4b559a2855dgi</span>
<span class="pl-c1">  24:     0x7f4a6cdb9a32 - trans::base::trans_crate::hf005d8f63d50ea8004i</span>
<span class="pl-c1">  25:     0x7f4a6e537466 - driver::phase_4_translate_to_llvm::h86819ae7902c932bnOa</span>
<span class="pl-c1">  26:     0x7f4a6e513266 - driver::compile_input::h6e596544d26b4394Qba</span>
<span class="pl-c1">  27:     0x7f4a6e5c9041 - run_compiler::haa6c0289fab7415475b</span>
<span class="pl-c1">  28:     0x7f4a6e5c6892 - boxed::F.FnBox&lt;A&gt;::call_box::h10721825727138786690</span>
<span class="pl-c1">  29:     0x7f4a6e5c5e59 - rt::unwind::try::try_fn::h6014602198652783625</span>
<span class="pl-c1">  30:     0x7f4a6e05fb58 - rust_try_inner</span>
<span class="pl-c1">  31:     0x7f4a6e05fb45 - rust_try</span>
<span class="pl-c1">  32:     0x7f4a6e5c60f4 - boxed::F.FnBox&lt;A&gt;::call_box::h5510246712457526188</span>
<span class="pl-c1">  33:     0x7f4a6dfe61e1 - sys::thread::Thread::new::thread_start::h11fbc90f6ba541f9zvv</span>
<span class="pl-c1">  34:     0x7f4a68877ee4 - start_thread</span>
<span class="pl-c1">  35:     0x7f4a6dc29d1c - clone</span>
<span class="pl-c1">  36:                0x0 - &lt;unknown&gt;</span>

<span class="pl-c1">Could not compile `hello_world`.</span>

<span class="pl-c1">Caused by:</span>
<span class="pl-c1">  Process didn't exit successfully: `rustc src/lib.rs --crate-name hello_world --crate-type lib -g --out-dir /home/miK/workspaces/Rust/bug/target/debug --emit=dep-info,link -L dependency=/home/miK/workspaces/Rust/bug/target/debug -L dependency=/home/miK/workspaces/Rust/bug/target/debug/deps` (exit code: 101)</span></pre></div>
<p dir="auto">Metadata</p>
<div class="highlight highlight-text-shell-session notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="[miK@i5760-miK bug]$ rustc --verbose --version
rustc 1.1.0 (35ceea399 2015-06-19)
binary: rustc
commit-hash: 35ceea3997c79a3b7562e89b462ab76af5b86b22
commit-date: 2015-06-19
host: x86_64-unknown-linux-gnu
release: 1.1.0"><pre class="notranslate"><span class="pl-e">[miK@i5760-miK bug]</span>$ <span class="pl-s1">rustc --verbose --version</span>
<span class="pl-c1">rustc 1.1.0 (35ceea399 2015-06-19)</span>
<span class="pl-c1">binary: rustc</span>
<span class="pl-c1">commit-hash: 35ceea3997c79a3b7562e89b462ab76af5b86b22</span>
<span class="pl-c1">commit-date: 2015-06-19</span>
<span class="pl-c1">host: x86_64-unknown-linux-gnu</span>
<span class="pl-c1">release: 1.1.0</span></pre></div>
<div class="highlight highlight-source-rust notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="enum Foo {
    Bar(int, [int]),
}

fn main() {
    // Either of these lines can cause the ICE
    let _x: &amp;(int, [int]);
    let _y: &amp;Foo;
}"><pre class="notranslate"><span class="pl-k">enum</span> <span class="pl-smi">Foo</span> <span class="pl-kos">{</span>
    <span class="pl-v">Bar</span><span class="pl-kos">(</span><span class="pl-smi">int</span><span class="pl-kos">,</span> <span class="pl-kos">[</span><span class="pl-smi">int</span><span class="pl-kos">]</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">main</span><span class="pl-kos">(</span><span class="pl-kos">)</span> <span class="pl-kos">{</span>
    <span class="pl-c">// Either of these lines can cause the ICE</span>
    <span class="pl-k">let</span> _x<span class="pl-kos">:</span> <span class="pl-c1">&amp;</span><span class="pl-kos">(</span><span class="pl-smi">int</span><span class="pl-kos">,</span> <span class="pl-kos">[</span><span class="pl-smi">int</span><span class="pl-kos">]</span><span class="pl-kos">)</span><span class="pl-kos">;</span>
    <span class="pl-k">let</span> _y<span class="pl-kos">:</span> <span class="pl-c1">&amp;</span><span class="pl-smi">Foo</span><span class="pl-kos">;</span>
<span class="pl-kos">}</span></pre></div>
<p dir="auto">Backtrace:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="   1:     0x7f2a127e8580 - rt::backtrace::imp::write::h0180e7ded76a3ff2c0q
   2:     0x7f2a127eb770 - failure::on_fail::h3f169393c89b5f90Tlr
   3:     0x7f2a12fd24f0 - unwind::begin_unwind_inner::haeb9517b5061bc86Zie
   4:     0x7f2a133ad670 - unwind::begin_unwind::h17017358962417336117
   5:     0x7f2a13803a20 - middle::ty::unsized_part_of_type::h8eae6d239e9b7af3tnG
   6:     0x7f2a138037c0 - middle::trans::type_of::type_of::type_of_unsize_info::h67819f63aa2acfb5Xh9
   7:     0x7f2a1377b050 - middle::trans::type_of::type_of::h3c89a1738d384c45Ih9
   8:     0x7f2a1377b050 - middle::trans::type_of::type_of::h3c89a1738d384c45Ih9
   9:     0x7f2a137b0860 - middle::trans::base::alloc_ty::h5485998eeb61d023mTd
  10:     0x7f2a13859870 - middle::trans::_match::mk_binding_alloca::h11628361498234501597
  11:     0x7f2a1385bdf0 - middle::trans::_match::store_local::create_dummy_locals::closure.119283
  12:     0x7f2a13681560 - middle::pat_util::pat_bindings::closure.112016
  13:     0x7f2a0ea1ccb0 - ast_util::walk_pat::hc858153057fb5965oRB
  14:     0x7f2a138205f0 - middle::trans::_match::store_local::h9195017fe21b4124A2h
  15:     0x7f2a13772d10 - middle::trans::base::init_local::h5e8a493dc2ae05b1WFd
  16:     0x7f2a13772220 - middle::trans::controlflow::trans_stmt::hf26d5cee55a6056blhY
  17:     0x7f2a13773c40 - middle::trans::controlflow::trans_block::h004dea36138a75c8wmY
  18:     0x7f2a13829560 - middle::trans::base::trans_closure::h655acfc433ac13fevye
  19:     0x7f2a13764670 - middle::trans::base::trans_fn::hf0a444fa9ff43aebiKe
  20:     0x7f2a1375f9b0 - middle::trans::base::trans_item::hda4d4160cb2b58dfi2e
  21:     0x7f2a138341f0 - middle::trans::base::trans_crate::hff0f87c98e6356c8JWf
  22:     0x7f2a13c058d0 - driver::driver::phase_4_translate_to_llvm::h8223ee9d7ab4951cpzy
  23:     0x7f2a13bfd280 - driver::driver::compile_input::hfa4fd95c9e6a2ceeQby
  24:     0x7f2a13c8f0a0 - driver::run_compiler::h32bdccca6ed9465cJIB
  25:     0x7f2a13c8efb0 - driver::main_args::closure.138206
  26:     0x7f2a13ca1240 - task::TaskBuilder&lt;S&gt;::try_future::closure.139324
  27:     0x7f2a13ca1040 - task::TaskBuilder&lt;S&gt;::spawn_internal::closure.139301
  28:     0x7f2a146dcf10 - task::spawn_opts::closure.8369
  29:     0x7f2a1302af90 - rust_try_inner
  30:     0x7f2a1302af80 - rust_try
  31:     0x7f2a12fcfb20 - unwind::try::h03d8d1d4cb0de0c1f7d
  32:     0x7f2a12fcf8e0 - task::Task::run::hafab6bcab45e61e5zdd
  33:     0x7f2a146dcc70 - task::spawn_opts::closure.8315
  34:     0x7f2a12fd16e0 - thread::thread_start::hba588af1f803bb5blCd
  35:     0x7f2a1227f0c0 - start_thread
  36:     0x7f2a12c99359 - __clone
  37:                0x0 - &lt;unknown&gt;"><pre class="notranslate"><code class="notranslate">   1:     0x7f2a127e8580 - rt::backtrace::imp::write::h0180e7ded76a3ff2c0q
   2:     0x7f2a127eb770 - failure::on_fail::h3f169393c89b5f90Tlr
   3:     0x7f2a12fd24f0 - unwind::begin_unwind_inner::haeb9517b5061bc86Zie
   4:     0x7f2a133ad670 - unwind::begin_unwind::h17017358962417336117
   5:     0x7f2a13803a20 - middle::ty::unsized_part_of_type::h8eae6d239e9b7af3tnG
   6:     0x7f2a138037c0 - middle::trans::type_of::type_of::type_of_unsize_info::h67819f63aa2acfb5Xh9
   7:     0x7f2a1377b050 - middle::trans::type_of::type_of::h3c89a1738d384c45Ih9
   8:     0x7f2a1377b050 - middle::trans::type_of::type_of::h3c89a1738d384c45Ih9
   9:     0x7f2a137b0860 - middle::trans::base::alloc_ty::h5485998eeb61d023mTd
  10:     0x7f2a13859870 - middle::trans::_match::mk_binding_alloca::h11628361498234501597
  11:     0x7f2a1385bdf0 - middle::trans::_match::store_local::create_dummy_locals::closure.119283
  12:     0x7f2a13681560 - middle::pat_util::pat_bindings::closure.112016
  13:     0x7f2a0ea1ccb0 - ast_util::walk_pat::hc858153057fb5965oRB
  14:     0x7f2a138205f0 - middle::trans::_match::store_local::h9195017fe21b4124A2h
  15:     0x7f2a13772d10 - middle::trans::base::init_local::h5e8a493dc2ae05b1WFd
  16:     0x7f2a13772220 - middle::trans::controlflow::trans_stmt::hf26d5cee55a6056blhY
  17:     0x7f2a13773c40 - middle::trans::controlflow::trans_block::h004dea36138a75c8wmY
  18:     0x7f2a13829560 - middle::trans::base::trans_closure::h655acfc433ac13fevye
  19:     0x7f2a13764670 - middle::trans::base::trans_fn::hf0a444fa9ff43aebiKe
  20:     0x7f2a1375f9b0 - middle::trans::base::trans_item::hda4d4160cb2b58dfi2e
  21:     0x7f2a138341f0 - middle::trans::base::trans_crate::hff0f87c98e6356c8JWf
  22:     0x7f2a13c058d0 - driver::driver::phase_4_translate_to_llvm::h8223ee9d7ab4951cpzy
  23:     0x7f2a13bfd280 - driver::driver::compile_input::hfa4fd95c9e6a2ceeQby
  24:     0x7f2a13c8f0a0 - driver::run_compiler::h32bdccca6ed9465cJIB
  25:     0x7f2a13c8efb0 - driver::main_args::closure.138206
  26:     0x7f2a13ca1240 - task::TaskBuilder&lt;S&gt;::try_future::closure.139324
  27:     0x7f2a13ca1040 - task::TaskBuilder&lt;S&gt;::spawn_internal::closure.139301
  28:     0x7f2a146dcf10 - task::spawn_opts::closure.8369
  29:     0x7f2a1302af90 - rust_try_inner
  30:     0x7f2a1302af80 - rust_try
  31:     0x7f2a12fcfb20 - unwind::try::h03d8d1d4cb0de0c1f7d
  32:     0x7f2a12fcf8e0 - task::Task::run::hafab6bcab45e61e5zdd
  33:     0x7f2a146dcc70 - task::spawn_opts::closure.8315
  34:     0x7f2a12fd16e0 - thread::thread_start::hba588af1f803bb5blCd
  35:     0x7f2a1227f0c0 - start_thread
  36:     0x7f2a12c99359 - __clone
  37:                0x0 - &lt;unknown&gt;
</code></pre></div>
<p dir="auto">This seems to occur when using a non-struct type that contains an unsized type. This is probably because <a href="https://github.com/rust-lang/rust/blob/7932b719ec2b65acfa8c3e74aad29346d47ee992/src/librustc/middle/ty.rs#L2938-L2956"><code class="notranslate">unsized_part_of_type</code></a> only handles <code class="notranslate">ty_struct</code> and the base unsized types. This should be extended to handle enums and tuples as well.</p>