<p dir="auto">This (bogus) piece of code seems to cause ICE:</p>
<div class="highlight highlight-source-rust notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="pub struct Foo { x: usize }

fn main() {
    static mut FOO: *mut Foo = 0 as *mut Foo;
    let _foo = unsafe { *FOO.clone() };
}"><pre class="notranslate"><span class="pl-k">pub</span> <span class="pl-k">struct</span> <span class="pl-smi">Foo</span> <span class="pl-kos">{</span> <span class="pl-c1">x</span><span class="pl-kos">:</span> <span class="pl-smi">usize</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-k">static</span> <span class="pl-k">mut</span> <span class="pl-v">FOO</span><span class="pl-kos">:</span> <span class="pl-c1">*</span><span class="pl-k">mut</span> <span class="pl-smi">Foo</span> = <span class="pl-c1">0</span> <span class="pl-k">as</span> <span class="pl-c1">*</span><span class="pl-k">mut</span> <span class="pl-smi">Foo</span><span class="pl-kos">;</span>
    <span class="pl-k">let</span> _foo = <span class="pl-k">unsafe</span> <span class="pl-kos">{</span> <span class="pl-c1">*</span><span class="pl-v">FOO</span><span class="pl-kos">.</span><span class="pl-en">clone</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></pre></div>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="ice1.rs:7:25: 7:37 error: internal compiler error: this path should not cause illegal move
ice1.rs:7     let _foo = unsafe { *FOO.clone() };
                                  ^~~~~~~~~~~~
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 'Box&lt;Any&gt;', /home/rustbuild/src/rust-buildbot/slave/nightly-dist-rustc-linux/build/src/libsyntax/diagnostic.rs:126

stack backtrace:
   1:     0x7f39eddf5a20 - sys::backtrace::write::h8a4dc9e73e8a435dvRt
   2:     0x7f39ede178c0 - failure::on_fail::h2ba8afb30d5ff67304z
   3:     0x7f39edd86180 - rt::unwind::begin_unwind_inner::h312ad0c8f7e45209eKz
   4:     0x7f39e85fb260 - rt::unwind::begin_unwind::h15315692592335573570
   5:     0x7f39e85fb1f0 - diagnostic::SpanHandler::span_bug::h11bfe9a4af254f3cEpF
   6:     0x7f39ebc46810 - session::Session::span_bug::ha51922765346cd16Qcp
   7:     0x7f39ec82fad0 - borrowck::build_borrowck_dataflow_data::hebc757194a8694e9cQe
   8:     0x7f39ec82c810 - borrowck::borrowck_fn::haef4dce7234d2ed4zNe
   9:     0x7f39ec82d720 - borrowck::borrowck_item::h1b395aabbbe3f362xMe
  10:     0x7f39ec82dc90 - borrowck::check_crate::h2223249b2c5fb97apHe
  11:     0x7f39ee383470 - driver::phase_3_run_analysis_passes::h3ddac035093704e2WFa
  12:     0x7f39ee370c90 - driver::compile_input::h8f87e6545ca866f1Cba
  13:     0x7f39ee43b8e0 - run_compiler::h01aa999b613651f1l9b
  14:     0x7f39ee43a050 - thunk::F.Invoke&lt;A, R&gt;::invoke::h5072366889563560254
  15:     0x7f39ee438fb0 - rt::unwind::try::try_fn::h15081826542860147634
  16:     0x7f39ede7e930 - rust_try_inner
  17:     0x7f39ede7e920 - rust_try
  18:     0x7f39ee439260 - thunk::F.Invoke&lt;A, R&gt;::invoke::h301471058200503190
  19:     0x7f39ede05550 - sys::thread::thread_start::h204ed77b5f1055c7QGw
  20:     0x7f39e7e0dd30 - start_thread
  21:     0x7f39eda273a9 - clone
  22:                0x0 - &lt;unknown&gt;"><pre class="notranslate"><code class="notranslate">ice1.rs:7:25: 7:37 error: internal compiler error: this path should not cause illegal move
ice1.rs:7     let _foo = unsafe { *FOO.clone() };
                                  ^~~~~~~~~~~~
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 'Box&lt;Any&gt;', /home/rustbuild/src/rust-buildbot/slave/nightly-dist-rustc-linux/build/src/libsyntax/diagnostic.rs:126

stack backtrace:
   1:     0x7f39eddf5a20 - sys::backtrace::write::h8a4dc9e73e8a435dvRt
   2:     0x7f39ede178c0 - failure::on_fail::h2ba8afb30d5ff67304z
   3:     0x7f39edd86180 - rt::unwind::begin_unwind_inner::h312ad0c8f7e45209eKz
   4:     0x7f39e85fb260 - rt::unwind::begin_unwind::h15315692592335573570
   5:     0x7f39e85fb1f0 - diagnostic::SpanHandler::span_bug::h11bfe9a4af254f3cEpF
   6:     0x7f39ebc46810 - session::Session::span_bug::ha51922765346cd16Qcp
   7:     0x7f39ec82fad0 - borrowck::build_borrowck_dataflow_data::hebc757194a8694e9cQe
   8:     0x7f39ec82c810 - borrowck::borrowck_fn::haef4dce7234d2ed4zNe
   9:     0x7f39ec82d720 - borrowck::borrowck_item::h1b395aabbbe3f362xMe
  10:     0x7f39ec82dc90 - borrowck::check_crate::h2223249b2c5fb97apHe
  11:     0x7f39ee383470 - driver::phase_3_run_analysis_passes::h3ddac035093704e2WFa
  12:     0x7f39ee370c90 - driver::compile_input::h8f87e6545ca866f1Cba
  13:     0x7f39ee43b8e0 - run_compiler::h01aa999b613651f1l9b
  14:     0x7f39ee43a050 - thunk::F.Invoke&lt;A, R&gt;::invoke::h5072366889563560254
  15:     0x7f39ee438fb0 - rt::unwind::try::try_fn::h15081826542860147634
  16:     0x7f39ede7e930 - rust_try_inner
  17:     0x7f39ede7e920 - rust_try
  18:     0x7f39ee439260 - thunk::F.Invoke&lt;A, R&gt;::invoke::h301471058200503190
  19:     0x7f39ede05550 - sys::thread::thread_start::h204ed77b5f1055c7QGw
  20:     0x7f39e7e0dd30 - start_thread
  21:     0x7f39eda273a9 - clone
  22:                0x0 - &lt;unknown&gt;
</code></pre></div>
<p dir="auto">Input:</p>
<div class="highlight highlight-source-rust notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="struct T(u8);

fn t() -&gt; *mut T {
    unsafe { 0u8 as *mut T }
}

fn main() {
    let a = unsafe { *t() };
}"><pre class="notranslate"><span class="pl-k">struct</span> <span class="pl-smi">T</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-k">fn</span> <span class="pl-en">t</span><span class="pl-kos">(</span><span class="pl-kos">)</span> -&gt; <span class="pl-c1">*</span><span class="pl-k">mut</span> <span class="pl-smi">T</span> <span class="pl-kos">{</span>
    <span class="pl-k">unsafe</span> <span class="pl-kos">{</span> <span class="pl-c1">0u8</span> <span class="pl-k">as</span> <span class="pl-c1">*</span><span class="pl-k">mut</span> <span class="pl-smi">T</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-k">let</span> a = <span class="pl-k">unsafe</span> <span class="pl-kos">{</span> <span class="pl-c1">*</span><span class="pl-en">t</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></pre></div>
<p dir="auto">Output:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="$ rustc ../test.rs 
../test.rs:9:19: 9:23 error: internal compiler error: this path should not cause illegal move
../test.rs:9    let a = unsafe { *t() };
                                 ^~~~
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 'Box&lt;Any&gt;', /Users/John/Documents/dev/rust/src/libsyntax/diagnostic.rs:123

stack backtrace:
   1:        0x10f825b75 - sys::backtrace::write::h757d4037fec4513elCt
   2:        0x10f84800f - failure::on_fail::he99e1d2cd81a67a80Hz
   3:        0x10f7b3c8a - rt::unwind::begin_unwind_inner::hede15ebc165353e0Qpz
   4:        0x10d508707 - rt::unwind::begin_unwind::h5150449308391082809
   5:        0x10d50869c - diagnostic::SpanHandler::span_bug::h1cc7aa850b4525b9nQF
   6:        0x10c93bc1d - session::Session::span_bug::h9dff6f0c981e0b95mRq
   7:        0x10c547999 - borrowck::build_borrowck_dataflow_data::hbfab9f3785e58ec8QRe
   8:        0x10c5432fb - borrowck::borrowck_fn::h9d4d5a57ec1e26a2cPe
   9:        0x10c5440f2 - borrowck::borrowck_item::hd3de64f0b51b624a9Ne
  10:        0x10c54461f - borrowck::check_crate::hab49ad1d67fb67e9ZIe
  11:        0x10c09e8aa - driver::phase_3_run_analysis_passes::h3bf5eb3f470c8788gwa
  12:        0x10c082d90 - driver::compile_input::h63293298907e332cxba
  13:        0x10c14e7ba - monitor::unboxed_closure.22558
  14:        0x10c14cf15 - thunk::F.Invoke&lt;A, R&gt;::invoke::h15985566512806182469
  15:        0x10c14bcf0 - rt::unwind::try::try_fn::h5957420952141477940
  16:        0x10f8b1189 - rust_try_inner
  17:        0x10f8b1176 - rust_try
  18:        0x10c14c3ec - thunk::F.Invoke&lt;A, R&gt;::invoke::h12578415658120090831
  19:        0x10f835814 - sys::thread::thread_start::he6c5dcba45c95bf2drw
  20:     0x7fff933e22fc - _pthread_body
  21:     0x7fff933e2279 - _pthread_body"><pre class="notranslate"><code class="notranslate">$ rustc ../test.rs 
../test.rs:9:19: 9:23 error: internal compiler error: this path should not cause illegal move
../test.rs:9    let a = unsafe { *t() };
                                 ^~~~
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 'Box&lt;Any&gt;', /Users/John/Documents/dev/rust/src/libsyntax/diagnostic.rs:123

stack backtrace:
   1:        0x10f825b75 - sys::backtrace::write::h757d4037fec4513elCt
   2:        0x10f84800f - failure::on_fail::he99e1d2cd81a67a80Hz
   3:        0x10f7b3c8a - rt::unwind::begin_unwind_inner::hede15ebc165353e0Qpz
   4:        0x10d508707 - rt::unwind::begin_unwind::h5150449308391082809
   5:        0x10d50869c - diagnostic::SpanHandler::span_bug::h1cc7aa850b4525b9nQF
   6:        0x10c93bc1d - session::Session::span_bug::h9dff6f0c981e0b95mRq
   7:        0x10c547999 - borrowck::build_borrowck_dataflow_data::hbfab9f3785e58ec8QRe
   8:        0x10c5432fb - borrowck::borrowck_fn::h9d4d5a57ec1e26a2cPe
   9:        0x10c5440f2 - borrowck::borrowck_item::hd3de64f0b51b624a9Ne
  10:        0x10c54461f - borrowck::check_crate::hab49ad1d67fb67e9ZIe
  11:        0x10c09e8aa - driver::phase_3_run_analysis_passes::h3bf5eb3f470c8788gwa
  12:        0x10c082d90 - driver::compile_input::h63293298907e332cxba
  13:        0x10c14e7ba - monitor::unboxed_closure.22558
  14:        0x10c14cf15 - thunk::F.Invoke&lt;A, R&gt;::invoke::h15985566512806182469
  15:        0x10c14bcf0 - rt::unwind::try::try_fn::h5957420952141477940
  16:        0x10f8b1189 - rust_try_inner
  17:        0x10f8b1176 - rust_try
  18:        0x10c14c3ec - thunk::F.Invoke&lt;A, R&gt;::invoke::h12578415658120090831
  19:        0x10f835814 - sys::thread::thread_start::he6c5dcba45c95bf2drw
  20:     0x7fff933e22fc - _pthread_body
  21:     0x7fff933e2279 - _pthread_body
</code></pre></div>