<h3 dir="auto">STR</h3>
<div class="highlight highlight-source-rust notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="#![crate_type = &quot;lib&quot;]

use std::mem;
use std::ops::Deref;

fn ice(sample: &amp;Sample&lt;f32&gt;) {
    let slice: &amp;[f32] = sample;
}

fn ok(sample: &amp;Sample&lt;f32&gt;) {
    let slice: &amp;[f32] = unsafe { mem::transmute(sample) };
}

struct Sample&lt;A&gt;([A]);

impl&lt;A&gt; Deref for Sample&lt;A&gt; {
    type Target = [A];

    fn deref(&amp;self) -&gt; &amp;[A] {
        unsafe {
            mem::transmute(self)
        }
    }
}"><pre class="notranslate"><span class="pl-c1">#!<span class="pl-kos">[</span>crate_type = <span class="pl-s">"lib"</span><span class="pl-kos">]</span></span>

<span class="pl-k">use</span> std<span class="pl-kos">::</span>mem<span class="pl-kos">;</span>
<span class="pl-k">use</span> std<span class="pl-kos">::</span>ops<span class="pl-kos">::</span><span class="pl-v">Deref</span><span class="pl-kos">;</span>

<span class="pl-k">fn</span> <span class="pl-en">ice</span><span class="pl-kos">(</span><span class="pl-s1">sample</span><span class="pl-kos">:</span> <span class="pl-c1">&amp;</span><span class="pl-smi">Sample</span><span class="pl-kos">&lt;</span><span class="pl-smi">f32</span><span class="pl-kos">&gt;</span><span class="pl-kos">)</span> <span class="pl-kos">{</span>
    <span class="pl-k">let</span> slice<span class="pl-kos">:</span> <span class="pl-c1">&amp;</span><span class="pl-kos">[</span><span class="pl-smi">f32</span><span class="pl-kos">]</span> = sample<span class="pl-kos">;</span>
<span class="pl-kos">}</span>

<span class="pl-k">fn</span> <span class="pl-en">ok</span><span class="pl-kos">(</span><span class="pl-s1">sample</span><span class="pl-kos">:</span> <span class="pl-c1">&amp;</span><span class="pl-smi">Sample</span><span class="pl-kos">&lt;</span><span class="pl-smi">f32</span><span class="pl-kos">&gt;</span><span class="pl-kos">)</span> <span class="pl-kos">{</span>
    <span class="pl-k">let</span> slice<span class="pl-kos">:</span> <span class="pl-c1">&amp;</span><span class="pl-kos">[</span><span class="pl-smi">f32</span><span class="pl-kos">]</span> = <span class="pl-k">unsafe</span> <span class="pl-kos">{</span> mem<span class="pl-kos">::</span><span class="pl-en">transmute</span><span class="pl-kos">(</span>sample<span class="pl-kos">)</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">Sample</span><span class="pl-kos">&lt;</span><span class="pl-smi">A</span><span class="pl-kos">&gt;</span><span class="pl-kos">(</span><span class="pl-kos">[</span><span class="pl-smi">A</span><span class="pl-kos">]</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-smi">A</span><span class="pl-kos">&gt;</span> <span class="pl-smi">Deref</span> <span class="pl-k">for</span> <span class="pl-smi">Sample</span><span class="pl-kos">&lt;</span><span class="pl-smi">A</span><span class="pl-kos">&gt;</span> <span class="pl-kos">{</span>
    <span class="pl-k">type</span> <span class="pl-smi">Target</span> = <span class="pl-kos">[</span><span class="pl-smi">A</span><span class="pl-kos">]</span><span class="pl-kos">;</span>

    <span class="pl-k">fn</span> <span class="pl-en">deref</span><span class="pl-kos">(</span><span class="pl-c1">&amp;</span><span class="pl-smi">self</span><span class="pl-kos">)</span> -&gt; <span class="pl-c1">&amp;</span><span class="pl-kos">[</span><span class="pl-smi">A</span><span class="pl-kos">]</span> <span class="pl-kos">{</span>
        <span class="pl-k">unsafe</span> <span class="pl-kos">{</span>
            mem<span class="pl-kos">::</span><span class="pl-en">transmute</span><span class="pl-kos">(</span><span class="pl-smi">self</span><span class="pl-kos">)</span>
        <span class="pl-kos">}</span>
    <span class="pl-kos">}</span>
<span class="pl-kos">}</span></pre></div>
<h3 dir="auto">Backtrace</h3>
<div class="highlight highlight-source-rust 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: http://doc.rust-lang.org/complement-bugreport.html
note: run with `RUST_BACKTRACE=1` for a backtrace
thread 'rustc' panicked at 'unsized_part_of_type failed even though ty is unsized', /home/rustbuild/src/rust-buildbot/slave/nightly-dist-rustc-linux/build/src/librustc_trans/trans/common.rs:166

stack backtrace:
   1:     0x7fdc3bc535b0 - sys::backtrace::write::h0cbfc88baae43aa021y
   2:     0x7fdc3bc779b0 - failure::on_fail::h0a7ead13585065c0rcH
   3:     0x7fdc3bbd5970 - rt::unwind::begin_unwind_inner::h5389a239af7b06eeMQG
   4:     0x7fdc3a8a7d50 - rt::unwind::begin_unwind::h16123941288702621176
   5:     0x7fdc3a980310 - trans::common::unsized_part_of_type::ha72e8603712ad74dSRk
   6:     0x7fdc3a9b12a0 - trans::type_of::type_of::type_of_unsize_info::h8f9f7a388a336e9dm8o
   7:     0x7fdc3a903650 - trans::type_of::type_of::h26bd2a95f0ad4a3727o
   8:     0x7fdc3a9208a0 - trans::datum::Datum&lt;'tcx, Rvalue&gt;::to_ref_datum::h75fa0e01c0664e30YQf
   9:     0x7fdc3a920a00 - trans::datum::Datum&lt;'tcx, Rvalue&gt;::to_appropriate_datum::h6c5a00ca4a6144b7SRf
  10:     0x7fdc3a93fe30 - trans::callee::trans_arg_datum::h5d56fde4db281665Rqh
  11:     0x7fdc3a9330c0 - trans::callee::trans_args::h82e8228688fa879cShh
  12:     0x7fdc3a95d7a0 - trans::expr::trans_overloaded_op::h7dcf7ba6da813cf5I6j
  13:     0x7fdc3a979e60 - trans::expr::deref_once::h6284489ab9f07c9eBzk
  14:     0x7fdc3a94cf50 - trans::expr::deref_multiple::h48c0e59f95e290f1Zxk
  15:     0x7fdc3a8f9cb0 - trans::expr::trans::h4aa11cd527e88cd0dIh
  16:     0x7fdc3a8f8b20 - trans::expr::trans_into::h792bd9b430d8f7dfJEh
  17:     0x7fdc3a9fa950 - trans::_match::mk_binding_alloca::h4494187384434577009
  18:     0x7fdc3a8f81c0 - trans::base::init_local::he96ac71055395945not
  19:     0x7fdc3a8f9130 - trans::controlflow::trans_block::hd445a33426df7637Bde
  20:     0x7fdc3a9c4530 - trans::base::trans_closure::h899ff1df83d7583b9du
  21:     0x7fdc3a8e55e0 - trans::base::trans_fn::hc2298bc13eeb8cfappu
  22:     0x7fdc3a8e0570 - trans::base::trans_item::h03200b520668f12feOu
  23:     0x7fdc3a9cb990 - trans::base::trans_crate::ha94cd7a9cd13cad4yLv
  24:     0x7fdc3c269210 - driver::phase_4_translate_to_llvm::he09ab588c39cf70ewPa
  25:     0x7fdc3c242200 - driver::compile_input::h0eb7a1103ff8aba2Eba
  26:     0x7fdc3c3136e0 - run_compiler::ha9d14025fcb8e9fc5bc
  27:     0x7fdc3c311d40 - thunk::F.Invoke&lt;A, R&gt;::invoke::h5646167225587318028
  28:     0x7fdc3c310c30 - rt::unwind::try::try_fn::h4383208440922308355
  29:     0x7fdc3bce3d40 - rust_try_inner
  30:     0x7fdc3bce3d30 - rust_try
  31:     0x7fdc3c310ee0 - thunk::F.Invoke&lt;A, R&gt;::invoke::h10387639015308431532
  32:     0x7fdc3bc63ea0 - sys::thread::thread_start::h5a97a888379df6e9FQC
  33:     0x7fdc35c722b0 - start_thread
  34:     0x7fdc3b861249 - __clone
  35:                0x0 - &lt;unknown&gt;"><pre class="notranslate">error<span class="pl-kos">:</span> internal compiler error<span class="pl-kos">:</span> unexpected panic
note<span class="pl-kos">:</span> the compiler unexpectedly panicked<span class="pl-kos">.</span> <span class="pl-c1">this</span> is a bug<span class="pl-kos">.</span>
<span class="pl-c1">note</span><span class="pl-kos">:</span> we would appreciate a bug report<span class="pl-kos">:</span> http<span class="pl-kos">:</span><span class="pl-c">//doc.rust-lang.org/complement-bugreport.html</span>
note<span class="pl-kos">:</span> run with `<span class="pl-v">RUST_BACKTRACE</span>=<span class="pl-c1">1</span>` <span class="pl-k">for</span> a backtrace
thread <span class="pl-c1">'</span>rustc<span class="pl-c1">'</span> panicked at <span class="pl-c1">'</span>unsized_part_of_type failed even though ty is unsized<span class="pl-c1">'</span><span class="pl-kos">,</span> /home/rustbuild/src/rust-buildbot/slave/nightly-dist-rustc-linux/build/src/librustc_trans/trans/common<span class="pl-kos">.</span><span class="pl-c1">rs</span><span class="pl-kos">:</span><span class="pl-c1">166</span>

stack backtrace<span class="pl-kos">:</span>
   <span class="pl-c1">1</span><span class="pl-kos">:</span>     <span class="pl-c1">0x7fdc3bc535b0</span> - sys<span class="pl-kos">::</span>backtrace<span class="pl-kos">::</span>write<span class="pl-kos">::</span>h0cbfc88baae43aa021y
   <span class="pl-c1">2</span><span class="pl-kos">:</span>     <span class="pl-c1">0x7fdc3bc779b0</span> - failure<span class="pl-kos">::</span>on_fail<span class="pl-kos">::</span>h0a7ead13585065c0rcH
   <span class="pl-c1">3</span><span class="pl-kos">:</span>     <span class="pl-c1">0x7fdc3bbd5970</span> - rt<span class="pl-kos">::</span>unwind<span class="pl-kos">::</span>begin_unwind_inner<span class="pl-kos">::</span>h5389a239af7b06eeMQG
   <span class="pl-c1">4</span><span class="pl-kos">:</span>     <span class="pl-c1">0x7fdc3a8a7d50</span> - rt<span class="pl-kos">::</span>unwind<span class="pl-kos">::</span>begin_unwind<span class="pl-kos">::</span>h16123941288702621176
   <span class="pl-c1">5</span><span class="pl-kos">:</span>     <span class="pl-c1">0x7fdc3a980310</span> - trans<span class="pl-kos">::</span>common<span class="pl-kos">::</span>unsized_part_of_type<span class="pl-kos">::</span>ha72e8603712ad74dSRk
   <span class="pl-c1">6</span><span class="pl-kos">:</span>     <span class="pl-c1">0x7fdc3a9b12a0</span> - trans<span class="pl-kos">::</span>type_of<span class="pl-kos">::</span>type_of<span class="pl-kos">::</span>type_of_unsize_info<span class="pl-kos">::</span>h8f9f7a388a336e9dm8o
   <span class="pl-c1">7</span><span class="pl-kos">:</span>     <span class="pl-c1">0x7fdc3a903650</span> - trans<span class="pl-kos">::</span>type_of<span class="pl-kos">::</span>type_of<span class="pl-kos">::</span>h26bd2a95f0ad4a3727o
   <span class="pl-c1">8</span><span class="pl-kos">:</span>     <span class="pl-c1">0x7fdc3a9208a0</span> - trans<span class="pl-kos">::</span>datum<span class="pl-kos">::</span><span class="pl-v">Datum</span>&lt;<span class="pl-c1">'</span>tcx<span class="pl-kos">,</span> <span class="pl-v">Rvalue</span>&gt;<span class="pl-kos">::</span>to_ref_datum<span class="pl-kos">::</span>h75fa0e01c0664e30YQf
   <span class="pl-c1">9</span><span class="pl-kos">:</span>     <span class="pl-c1">0x7fdc3a920a00</span> - trans<span class="pl-kos">::</span>datum<span class="pl-kos">::</span><span class="pl-v">Datum</span>&lt;<span class="pl-c1">'</span>tcx<span class="pl-kos">,</span> <span class="pl-v">Rvalue</span>&gt;<span class="pl-kos">::</span>to_appropriate_datum<span class="pl-kos">::</span>h6c5a00ca4a6144b7SRf
  <span class="pl-c1">10</span><span class="pl-kos">:</span>     <span class="pl-c1">0x7fdc3a93fe30</span> - trans<span class="pl-kos">::</span>callee<span class="pl-kos">::</span>trans_arg_datum<span class="pl-kos">::</span>h5d56fde4db281665Rqh
  <span class="pl-c1">11</span><span class="pl-kos">:</span>     <span class="pl-c1">0x7fdc3a9330c0</span> - trans<span class="pl-kos">::</span>callee<span class="pl-kos">::</span>trans_args<span class="pl-kos">::</span>h82e8228688fa879cShh
  <span class="pl-c1">12</span><span class="pl-kos">:</span>     <span class="pl-c1">0x7fdc3a95d7a0</span> - trans<span class="pl-kos">::</span>expr<span class="pl-kos">::</span>trans_overloaded_op<span class="pl-kos">::</span>h7dcf7ba6da813cf5I6j
  <span class="pl-c1">13</span><span class="pl-kos">:</span>     <span class="pl-c1">0x7fdc3a979e60</span> - trans<span class="pl-kos">::</span>expr<span class="pl-kos">::</span>deref_once<span class="pl-kos">::</span>h6284489ab9f07c9eBzk
  <span class="pl-c1">14</span><span class="pl-kos">:</span>     <span class="pl-c1">0x7fdc3a94cf50</span> - trans<span class="pl-kos">::</span>expr<span class="pl-kos">::</span>deref_multiple<span class="pl-kos">::</span>h48c0e59f95e290f1Zxk
  <span class="pl-c1">15</span><span class="pl-kos">:</span>     <span class="pl-c1">0x7fdc3a8f9cb0</span> - trans<span class="pl-kos">::</span>expr<span class="pl-kos">::</span>trans<span class="pl-kos">::</span>h4aa11cd527e88cd0dIh
  <span class="pl-c1">16</span><span class="pl-kos">:</span>     <span class="pl-c1">0x7fdc3a8f8b20</span> - trans<span class="pl-kos">::</span>expr<span class="pl-kos">::</span>trans_into<span class="pl-kos">::</span>h792bd9b430d8f7dfJEh
  <span class="pl-c1">17</span><span class="pl-kos">:</span>     <span class="pl-c1">0x7fdc3a9fa950</span> - trans<span class="pl-kos">::</span>_match<span class="pl-kos">::</span>mk_binding_alloca<span class="pl-kos">::</span>h4494187384434577009
  <span class="pl-c1">18</span><span class="pl-kos">:</span>     <span class="pl-c1">0x7fdc3a8f81c0</span> - trans<span class="pl-kos">::</span>base<span class="pl-kos">::</span>init_local<span class="pl-kos">::</span>he96ac71055395945not
  <span class="pl-c1">19</span><span class="pl-kos">:</span>     <span class="pl-c1">0x7fdc3a8f9130</span> - trans<span class="pl-kos">::</span>controlflow<span class="pl-kos">::</span>trans_block<span class="pl-kos">::</span>hd445a33426df7637Bde
  <span class="pl-c1">20</span><span class="pl-kos">:</span>     <span class="pl-c1">0x7fdc3a9c4530</span> - trans<span class="pl-kos">::</span>base<span class="pl-kos">::</span>trans_closure<span class="pl-kos">::</span>h899ff1df83d7583b9du
  <span class="pl-c1">21</span><span class="pl-kos">:</span>     <span class="pl-c1">0x7fdc3a8e55e0</span> - trans<span class="pl-kos">::</span>base<span class="pl-kos">::</span>trans_fn<span class="pl-kos">::</span>hc2298bc13eeb8cfappu
  <span class="pl-c1">22</span><span class="pl-kos">:</span>     <span class="pl-c1">0x7fdc3a8e0570</span> - trans<span class="pl-kos">::</span>base<span class="pl-kos">::</span>trans_item<span class="pl-kos">::</span>h03200b520668f12feOu
  <span class="pl-c1">23</span><span class="pl-kos">:</span>     <span class="pl-c1">0x7fdc3a9cb990</span> - trans<span class="pl-kos">::</span>base<span class="pl-kos">::</span>trans_crate<span class="pl-kos">::</span>ha94cd7a9cd13cad4yLv
  <span class="pl-c1">24</span><span class="pl-kos">:</span>     <span class="pl-c1">0x7fdc3c269210</span> - driver<span class="pl-kos">::</span>phase_4_translate_to_llvm<span class="pl-kos">::</span>he09ab588c39cf70ewPa
  <span class="pl-c1">25</span><span class="pl-kos">:</span>     <span class="pl-c1">0x7fdc3c242200</span> - driver<span class="pl-kos">::</span>compile_input<span class="pl-kos">::</span>h0eb7a1103ff8aba2Eba
  <span class="pl-c1">26</span><span class="pl-kos">:</span>     <span class="pl-c1">0x7fdc3c3136e0</span> - run_compiler<span class="pl-kos">::</span>ha9d14025fcb8e9fc5bc
  <span class="pl-c1">27</span><span class="pl-kos">:</span>     <span class="pl-c1">0x7fdc3c311d40</span> - thunk<span class="pl-kos">::</span><span class="pl-v">F</span><span class="pl-kos">.</span><span class="pl-c1">Invoke</span>&lt;<span class="pl-v">A</span><span class="pl-kos">,</span> <span class="pl-v">R</span>&gt;<span class="pl-kos">::</span>invoke<span class="pl-kos">::</span>h5646167225587318028
  <span class="pl-c1">28</span><span class="pl-kos">:</span>     <span class="pl-c1">0x7fdc3c310c30</span> - rt<span class="pl-kos">::</span>unwind<span class="pl-kos">::</span>try<span class="pl-kos">::</span>try_fn<span class="pl-kos">::</span>h4383208440922308355
  <span class="pl-c1">29</span><span class="pl-kos">:</span>     <span class="pl-c1">0x7fdc3bce3d40</span> - rust_try_inner
  <span class="pl-c1">30</span><span class="pl-kos">:</span>     <span class="pl-c1">0x7fdc3bce3d30</span> - rust_try
  <span class="pl-c1">31</span><span class="pl-kos">:</span>     <span class="pl-c1">0x7fdc3c310ee0</span> - thunk<span class="pl-kos">::</span><span class="pl-v">F</span><span class="pl-kos">.</span><span class="pl-c1">Invoke</span>&lt;<span class="pl-v">A</span><span class="pl-kos">,</span> <span class="pl-v">R</span>&gt;<span class="pl-kos">::</span>invoke<span class="pl-kos">::</span>h10387639015308431532
  <span class="pl-c1">32</span><span class="pl-kos">:</span>     <span class="pl-c1">0x7fdc3bc63ea0</span> - sys<span class="pl-kos">::</span>thread<span class="pl-kos">::</span>thread_start<span class="pl-kos">::</span>h5a97a888379df6e9FQC
  <span class="pl-c1">33</span><span class="pl-kos">:</span>     <span class="pl-c1">0x7fdc35c722b0</span> - start_thread
  <span class="pl-c1">34</span><span class="pl-kos">:</span>     <span class="pl-c1">0x7fdc3b861249</span> - __clone
  <span class="pl-c1">35</span><span class="pl-kos">:</span>                <span class="pl-c1">0x0</span> - &lt;<span class="pl-smi">unknown</span>&gt;</pre></div>
<h3 dir="auto">Version</h3>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="rustc 1.0.0-nightly (a954663db 2015-02-10 22:08:30 +0000)"><pre class="notranslate"><code class="notranslate">rustc 1.0.0-nightly (a954663db 2015-02-10 22:08:30 +0000)
</code></pre></div>
<p dir="auto">cc <a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/nick29581/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://github.com/nick29581">@nick29581</a> <a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/eddyb/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://github.com/eddyb">@eddyb</a></p>
<p dir="auto">(NB <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="41361825" data-permission-text="Title is private" data-url="https://github.com/rust-lang/rust/issues/16812" data-hovercard-type="issue" data-hovercard-url="/rust-lang/rust/issues/16812/hovercard" href="https://github.com/rust-lang/rust/issues/16812">#16812</a> has the same ICE message, but it don't think it's a duplicate because that issue is about "complex" (unsupported?) DST structs that can't be obtained/created via a <code class="notranslate">mem::transmute</code>. On the other hand, this issue is about the known-to-work <code class="notranslate">NewType(Dst)</code>/<code class="notranslate">NewType { inner: Dst }</code> pattern)</p>
<p dir="auto">As per fixme.</p>