<p dir="auto">Here is the error:</p>
<div class="highlight highlight-source-shell notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="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
thread 'rustc' panicked at 'Unexpected type returned from struct_tail: (for&lt;'r,'r,'r&gt; core::ops::FnMut(&amp;'r widgets::tree_model::TreeModel, &amp;'r widgets::tree_iter::TreeIter, &amp;'r widgets::tree_iter::TreeIter, *mut libc::types::common::c95::c_void), *mut libc::types::common::c95::c_void) for ty=(for&lt;'r,'r,'r&gt; core::ops::FnMut(&amp;'r widgets::tree_model::TreeModel, &amp;'r widgets::tree_iter::TreeIter, &amp;'r widgets::tree_iter::TreeIter, *mut libc::types::common::c95::c_void), *mut libc::types::common::c95::c_void)', /home/rustbuild/src/rust-buildbot/slave/nightly-dist-rustc-linux/build/src/librustc_trans/trans/type_of.rs:354

stack backtrace:
   1:     0x7f3e757c5733 - sys::backtrace::write::h8f69c25b82e602958cs
   2:     0x7f3e757cd669 - panicking::on_panic::hfa966c25addcbd02XXw
   3:     0x7f3e7578dcfa - rt::unwind::begin_unwind_inner::h75eec641d76d2f34HDw
   4:     0x7f3e7578ea97 - rt::unwind::begin_unwind_fmt::hc239ae9d69c6846fNCw
   5:     0x7f3e7453ce81 - trans::type_of::in_memory_type_of::h3ecebb4824b43e04W4L
   6:     0x7f3e74606194 - trans::type_of::type_of_rust_fn::h607dc640440350a7FSL
   7:     0x7f3e745497bb - trans::declare::declare_rust_fn::h4800aa8c001370c2QaA
   8:     0x7f3e7456d757 - trans::base::register_fn::h9adaa07e7fa9572ajFi
   9:     0x7f3e7456888c - trans::base::get_item_val::heee81e685884b3511Ri
  10:     0x7f3e74564d86 - trans::base::trans_item::hf26865b4e5e5e2a9Kti
  11:     0x7f3e745656f8 - trans::base::trans_item::hf26865b4e5e5e2a9Kti
  12:     0x7f3e745656f8 - trans::base::trans_item::hf26865b4e5e5e2a9Kti
  13:     0x7f3e74572b02 - trans::base::trans_crate::h174636cd97c01262Wij
  14:     0x7f3e75d22cb4 - driver::phase_4_translate_to_llvm::h1e3de5efb53bc87ezOa
  15:     0x7f3e75cfe396 - driver::compile_input::hda494d426ffc5b8bQba
  16:     0x7f3e75db3cc1 - run_compiler::hd539ddde81e1e162n6b
  17:     0x7f3e75db1512 - boxed::F.FnBox&lt;A&gt;::call_box::h2241471336346299975
  18:     0x7f3e75db0d19 - rt::unwind::try::try_fn::h1392995902660742682
  19:     0x7f3e758464e8 - rust_try_inner
  20:     0x7f3e758464d5 - rust_try
  21:     0x7f3e757b8ee7 - rt::unwind::try::inner_try::hfac58a0de8636543Azw
  22:     0x7f3e75db0f39 - boxed::F.FnBox&lt;A&gt;::call_box::h9914386528590371672
  23:     0x7f3e757cc321 - sys::thread::Thread::new::thread_start::h5dbb55e110740b5cMJv
  24:     0x7f3e6f7b3181 - start_thread
  25:     0x7f3e7540d47c - __clone
  26:                0x0 - &lt;unknown&gt;

Could not compile `gtk`."><pre class="notranslate">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
thread <span class="pl-s"><span class="pl-pds">'</span>rustc<span class="pl-pds">'</span></span> panicked at <span class="pl-s"><span class="pl-pds">'</span>Unexpected type returned from struct_tail: (for&lt;<span class="pl-pds">'</span></span>r,<span class="pl-s"><span class="pl-pds">'</span>r,<span class="pl-pds">'</span></span>r<span class="pl-k">&gt;</span> core::ops::FnMut(<span class="pl-k">&amp;</span><span class="pl-s"><span class="pl-pds">'</span>r widgets::tree_model::TreeModel, &amp;<span class="pl-pds">'</span></span>r widgets::tree_iter::TreeIter, <span class="pl-k">&amp;</span><span class="pl-s"><span class="pl-pds">'</span>r widgets::tree_iter::TreeIter, *mut libc::types::common::c95::c_void), *mut libc::types::common::c95::c_void) for ty=(for&lt;<span class="pl-pds">'</span></span>r,<span class="pl-s"><span class="pl-pds">'</span>r,<span class="pl-pds">'</span></span>r<span class="pl-k">&gt;</span> core::ops::FnMut(<span class="pl-k">&amp;</span><span class="pl-s"><span class="pl-pds">'</span>r widgets::tree_model::TreeModel, &amp;<span class="pl-pds">'</span></span>r widgets::tree_iter::TreeIter, <span class="pl-k">&amp;</span><span class="pl-s"><span class="pl-pds">'</span>r widgets::tree_iter::TreeIter, *mut libc::types::common::c95::c_void), *mut libc::types::common::c95::c_void)<span class="pl-pds">'</span></span>, /home/rustbuild/src/rust-buildbot/slave/nightly-dist-rustc-linux/build/src/librustc_trans/trans/type_of.rs:354

stack backtrace:
   1:     0x7f3e757c5733 - sys::backtrace::write::h8f69c25b82e602958cs
   2:     0x7f3e757cd669 - panicking::on_panic::hfa966c25addcbd02XXw
   3:     0x7f3e7578dcfa - rt::unwind::begin_unwind_inner::h75eec641d76d2f34HDw
   4:     0x7f3e7578ea97 - rt::unwind::begin_unwind_fmt::hc239ae9d69c6846fNCw
   5:     0x7f3e7453ce81 - trans::type_of::in_memory_type_of::h3ecebb4824b43e04W4L
   6:     0x7f3e74606194 - trans::type_of::type_of_rust_fn::h607dc640440350a7FSL
   7:     0x7f3e745497bb - trans::declare::declare_rust_fn::h4800aa8c001370c2QaA
   8:     0x7f3e7456d757 - trans::base::register_fn::h9adaa07e7fa9572ajFi
   9:     0x7f3e7456888c - trans::base::get_item_val::heee81e685884b3511Ri
  10:     0x7f3e74564d86 - trans::base::trans_item::hf26865b4e5e5e2a9Kti
  11:     0x7f3e745656f8 - trans::base::trans_item::hf26865b4e5e5e2a9Kti
  12:     0x7f3e745656f8 - trans::base::trans_item::hf26865b4e5e5e2a9Kti
  13:     0x7f3e74572b02 - trans::base::trans_crate::h174636cd97c01262Wij
  14:     0x7f3e75d22cb4 - driver::phase_4_translate_to_llvm::h1e3de5efb53bc87ezOa
  15:     0x7f3e75cfe396 - driver::compile_input::hda494d426ffc5b8bQba
  16:     0x7f3e75db3cc1 - run_compiler::hd539ddde81e1e162n6b
  17:     0x7f3e75db1512 - boxed::F.FnBox<span class="pl-k">&lt;</span>A<span class="pl-k">&gt;</span>::call_box::h2241471336346299975
  18:     0x7f3e75db0d19 - rt::unwind::try::try_fn::h1392995902660742682
  19:     0x7f3e758464e8 - rust_try_inner
  20:     0x7f3e758464d5 - rust_try
  21:     0x7f3e757b8ee7 - rt::unwind::try::inner_try::hfac58a0de8636543Azw
  22:     0x7f3e75db0f39 - boxed::F.FnBox<span class="pl-k">&lt;</span>A<span class="pl-k">&gt;</span>::call_box::h9914386528590371672
  23:     0x7f3e757cc321 - sys::thread::Thread::new::thread_start::h5dbb55e110740b5cMJv
  24:     0x7f3e6f7b3181 - start_thread
  25:     0x7f3e7540d47c - __clone
  26:                0x0 - <span class="pl-k">&lt;</span>unknown<span class="pl-k">&gt;</span>

Could not compile <span class="pl-s"><span class="pl-pds">`</span>gtk<span class="pl-pds">`</span></span>.</pre></div>
<p dir="auto">Here is the <a href="https://github.com/GuillaumeGomez/gtk/blob/master/src/traits/tree_sortable.rs">file</a> and <a href="https://github.com/GuillaumeGomez/gtk/blob/master/src/traits/tree_sortable.rs#L13">here</a> is the code.</p>
<p dir="auto"><code class="notranslate">rustc</code> is not checking that all types that are put into a sized-context are in fact sized.</p>
<p dir="auto">Consider for example:</p>
<div class="highlight highlight-source-rust notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="pub enum BsonValue {
    A([u8]),
    B([BsonValue]),
}

pub fn set_value(_v:&amp;BsonValue)
{
}

fn main()
{
}"><pre class="notranslate"><span class="pl-k">pub</span> <span class="pl-k">enum</span> <span class="pl-smi">BsonValue</span> <span class="pl-kos">{</span>
    <span class="pl-v">A</span><span class="pl-kos">(</span><span class="pl-kos">[</span><span class="pl-smi">u8</span><span class="pl-kos">]</span><span class="pl-kos">)</span><span class="pl-kos">,</span>
    <span class="pl-v">B</span><span class="pl-kos">(</span><span class="pl-kos">[</span><span class="pl-smi">BsonValue</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">set_value</span><span class="pl-kos">(</span><span class="pl-s1">_v</span><span class="pl-kos">:</span><span class="pl-c1">&amp;</span><span class="pl-smi">BsonValue</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-kos">}</span></pre></div>
<p dir="auto">This yields an ICE:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="thread 'rustc' panicked at 'Unexpected type returned from struct_tail: BsonValue for ty=BsonValue', /home/rustbuild/src/rust-buildbot/slave/beta-dist-rustc-linux/build/src/librustc_trans/trans/type_of.rs:366"><pre class="notranslate"><code class="notranslate">thread 'rustc' panicked at 'Unexpected type returned from struct_tail: BsonValue for ty=BsonValue', /home/rustbuild/src/rust-buildbot/slave/beta-dist-rustc-linux/build/src/librustc_trans/trans/type_of.rs:366
</code></pre></div>
<h2 dir="auto">Original bug report follows</h2>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="erics-air-2:Elmo eric$ rustc --version
rustc 1.0.0-beta.3 (5241bf9c3 2015-04-25) (built 2015-04-25)"><pre class="notranslate"><code class="notranslate">erics-air-2:Elmo eric$ rustc --version
rustc 1.0.0-beta.3 (5241bf9c3 2015-04-25) (built 2015-04-25)
</code></pre></div>
<p dir="auto">I'm on MacOS X Mavericks.</p>
<p dir="auto">Here's the source file that causes the problem (I'm a rust newbie):</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="enum BsonValue {
    BDouble(f64),
    BString(String),
    BInt64(i64),
    BInt32(i32),
    BUndefined,
    BObjectID([u8]),
    BNull,
    BRegex(String,String),
    BJSCode(String),
    BJSCodeWithScope(String),
    BBinary(u8,[u8]),
    BMinKey,
    BMaxKey,
    BDateTime(i64),
    BTimeStamp(i64),
    BBoolean(bool),
    BArray([BsonValue]),
    BDocument([(String,BsonValue)]),
}

fn setValueForKey (doc:&amp;BsonValue, k:String, v:&amp;BsonValue)
{
}

fn main()
{
}"><pre class="notranslate"><code class="notranslate">enum BsonValue {
    BDouble(f64),
    BString(String),
    BInt64(i64),
    BInt32(i32),
    BUndefined,
    BObjectID([u8]),
    BNull,
    BRegex(String,String),
    BJSCode(String),
    BJSCodeWithScope(String),
    BBinary(u8,[u8]),
    BMinKey,
    BMaxKey,
    BDateTime(i64),
    BTimeStamp(i64),
    BBoolean(bool),
    BArray([BsonValue]),
    BDocument([(String,BsonValue)]),
}

fn setValueForKey (doc:&amp;BsonValue, k:String, v:&amp;BsonValue)
{
}

fn main()
{
}
</code></pre></div>
<p dir="auto">And here's the output of the compiler:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="erics-air-2:Elmo eric$ RUST_BACKTRACE=1 rustc b.rs
b.rs:2:1: 21:2 warning: enum is never used: `BsonValue`, #[warn(dead_code)] on by default
b.rs:2 enum BsonValue {
b.rs:3     BDouble(f64),
b.rs:4     BString(String),
b.rs:5     BInt64(i64),
b.rs:6     BInt32(i32),
b.rs:7     BUndefined,
       ...
b.rs:23:1: 25:2 warning: function is never used: `setValueForKey`, #[warn(dead_code)] on by default
b.rs:23 fn setValueForKey (doc:&amp;BsonValue, k:String, v:&amp;BsonValue)
b.rs:24 {
b.rs:25 }
b.rs:23:20: 23:23 warning: unused variable: `doc`, #[warn(unused_variables)] on by default
b.rs:23 fn setValueForKey (doc:&amp;BsonValue, k:String, v:&amp;BsonValue)
                           ^~~
b.rs:23:36: 23:37 warning: unused variable: `k`, #[warn(unused_variables)] on by default
b.rs:23 fn setValueForKey (doc:&amp;BsonValue, k:String, v:&amp;BsonValue)
                                           ^
b.rs:23:46: 23:47 warning: unused variable: `v`, #[warn(unused_variables)] on by default
b.rs:23 fn setValueForKey (doc:&amp;BsonValue, k:String, v:&amp;BsonValue)
                                                     ^
b.rs:23:1: 25:2 warning: function `setValueForKey` should have a snake case name such as `set_value_for_key`, #[warn(non_snake_case)] on by default
b.rs:23 fn setValueForKey (doc:&amp;BsonValue, k:String, v:&amp;BsonValue)
b.rs:24 {
b.rs:25 }
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: BsonValue for ty=BsonValue', /Users/rustbuild/src/rust-buildbot/slave/beta-dist-rustc-mac/build/src/librustc_trans/trans/type_of.rs:366

stack backtrace:
   1:        0x1085cc33f - sys::backtrace::write::h0f2fc53eb11eb814gWr
   2:        0x1085d4942 - panicking::on_panic::hd617a4042e8486fciUv
   3:        0x108591375 - rt::unwind::begin_unwind_inner::hd84dfec22ac3667d1Bv
   4:        0x108592206 - rt::unwind::begin_unwind_fmt::h5bb6fa95bd57b24bFAv
   5:        0x10566046f - trans::type_of::in_memory_type_of::hb4e9c324c5b50f3epkL
   6:        0x105732682 - trans::type_of::type_of_rust_fn::h693a4c7fdf6ff62b87K
   7:        0x10566e00c - trans::declare::declare_rust_fn::hb0911ef870c7fe86SJz
   8:        0x10569462f - trans::base::register_fn::ha9cdc6c185aa084bVmi
   9:        0x10568f2d1 - trans::base::get_item_val::hfda21a63917f43e1Dzi
  10:        0x10568b3c7 - trans::base::trans_item::h2033cab24c2319dbFbi
  11:        0x10569a220 - trans::base::trans_crate::h3375b1d0f4de8d89F0i
  12:        0x10511ed4e - driver::phase_4_translate_to_llvm::hc94112f0d91aac3chOa
  13:        0x1050f72a4 - driver::compile_input::h4747d8bb1c595fdfQba
  14:        0x1051be8f3 - run_compiler::hc8c95c5858347fdbz4b
  15:        0x1051bc41a - boxed::F.FnBox&lt;A&gt;::call_box::h7872786064439979928
  16:        0x1051bb8b7 - rt::unwind::try::try_fn::h10239991317224243769
  17:        0x1086557c8 - rust_try_inner
  18:        0x1086557b5 - rust_try
  19:        0x1051bbb90 - boxed::F.FnBox&lt;A&gt;::call_box::h4543691575426869824
  20:        0x1085d348d - sys::thread::create::thread_start::h499b3be451a7bbb8AZu
  21:     0x7fff8aca1898 - _pthread_body
  22:     0x7fff8aca1729 - _pthread_start"><pre class="notranslate"><code class="notranslate">erics-air-2:Elmo eric$ RUST_BACKTRACE=1 rustc b.rs
b.rs:2:1: 21:2 warning: enum is never used: `BsonValue`, #[warn(dead_code)] on by default
b.rs:2 enum BsonValue {
b.rs:3     BDouble(f64),
b.rs:4     BString(String),
b.rs:5     BInt64(i64),
b.rs:6     BInt32(i32),
b.rs:7     BUndefined,
       ...
b.rs:23:1: 25:2 warning: function is never used: `setValueForKey`, #[warn(dead_code)] on by default
b.rs:23 fn setValueForKey (doc:&amp;BsonValue, k:String, v:&amp;BsonValue)
b.rs:24 {
b.rs:25 }
b.rs:23:20: 23:23 warning: unused variable: `doc`, #[warn(unused_variables)] on by default
b.rs:23 fn setValueForKey (doc:&amp;BsonValue, k:String, v:&amp;BsonValue)
                           ^~~
b.rs:23:36: 23:37 warning: unused variable: `k`, #[warn(unused_variables)] on by default
b.rs:23 fn setValueForKey (doc:&amp;BsonValue, k:String, v:&amp;BsonValue)
                                           ^
b.rs:23:46: 23:47 warning: unused variable: `v`, #[warn(unused_variables)] on by default
b.rs:23 fn setValueForKey (doc:&amp;BsonValue, k:String, v:&amp;BsonValue)
                                                     ^
b.rs:23:1: 25:2 warning: function `setValueForKey` should have a snake case name such as `set_value_for_key`, #[warn(non_snake_case)] on by default
b.rs:23 fn setValueForKey (doc:&amp;BsonValue, k:String, v:&amp;BsonValue)
b.rs:24 {
b.rs:25 }
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: BsonValue for ty=BsonValue', /Users/rustbuild/src/rust-buildbot/slave/beta-dist-rustc-mac/build/src/librustc_trans/trans/type_of.rs:366

stack backtrace:
   1:        0x1085cc33f - sys::backtrace::write::h0f2fc53eb11eb814gWr
   2:        0x1085d4942 - panicking::on_panic::hd617a4042e8486fciUv
   3:        0x108591375 - rt::unwind::begin_unwind_inner::hd84dfec22ac3667d1Bv
   4:        0x108592206 - rt::unwind::begin_unwind_fmt::h5bb6fa95bd57b24bFAv
   5:        0x10566046f - trans::type_of::in_memory_type_of::hb4e9c324c5b50f3epkL
   6:        0x105732682 - trans::type_of::type_of_rust_fn::h693a4c7fdf6ff62b87K
   7:        0x10566e00c - trans::declare::declare_rust_fn::hb0911ef870c7fe86SJz
   8:        0x10569462f - trans::base::register_fn::ha9cdc6c185aa084bVmi
   9:        0x10568f2d1 - trans::base::get_item_val::hfda21a63917f43e1Dzi
  10:        0x10568b3c7 - trans::base::trans_item::h2033cab24c2319dbFbi
  11:        0x10569a220 - trans::base::trans_crate::h3375b1d0f4de8d89F0i
  12:        0x10511ed4e - driver::phase_4_translate_to_llvm::hc94112f0d91aac3chOa
  13:        0x1050f72a4 - driver::compile_input::h4747d8bb1c595fdfQba
  14:        0x1051be8f3 - run_compiler::hc8c95c5858347fdbz4b
  15:        0x1051bc41a - boxed::F.FnBox&lt;A&gt;::call_box::h7872786064439979928
  16:        0x1051bb8b7 - rt::unwind::try::try_fn::h10239991317224243769
  17:        0x1086557c8 - rust_try_inner
  18:        0x1086557b5 - rust_try
  19:        0x1051bbb90 - boxed::F.FnBox&lt;A&gt;::call_box::h4543691575426869824
  20:        0x1085d348d - sys::thread::create::thread_start::h499b3be451a7bbb8AZu
  21:     0x7fff8aca1898 - _pthread_body
  22:     0x7fff8aca1729 - _pthread_start
</code></pre></div>