<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="trait Trait { }

fn function(t: &amp;mut Trait) {
    t as *mut Trait
}

fn main() { }"><pre class="notranslate"><code class="notranslate">trait Trait { }

fn function(t: &amp;mut Trait) {
    t as *mut Trait
}

fn main() { }
</code></pre></div>
<p dir="auto">This ICEs with the following message:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="$ RUST_BACKTRACE=1 rustc a.rs 
a.rs:4:5: 4:6 error: internal compiler error: expected object type
a.rs:4     t as *mut Trait
           ^
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
task 'rustc' panicked at 'Box&lt;Any&gt;', /home/hein/git/rust/src/libsyntax/diagnostic.rs:116

stack backtrace:
   1:     0x7fba24ef8d50 - rt::backtrace::imp::write::h62769dcaa7983ed8FNs
   2:     0x7fba24efbdd0 - &lt;unknown&gt;
   3:     0x7fba256a43e0 - unwind::begin_unwind_inner::h3fca55fd1ce1f347o9c
   4:     0x7fba23e4f460 - &lt;unknown&gt;
   5:     0x7fba23e4f3e0 - diagnostic::SpanHandler::span_bug::hea3a64b392293aeaDRF
   6:     0x7fba25c49ad0 - driver::session::Session::span_bug::hb3878c8c794bf1dcHNC
   7:     0x7fba25f4a260 - middle::typeck::check::vtable::check_object_cast::h7d7ee59c0ae09980HKN
   8:     0x7fba25fb8090 - &lt;unknown&gt;
   9:     0x7fba25fe62b0 - &lt;unknown&gt;
  10:     0x7fba25fab4c0 - &lt;unknown&gt;
  11:     0x7fba25fa7eb0 - &lt;unknown&gt;
  12:     0x7fba25fa7bf0 - &lt;unknown&gt;
  13:     0x7fba25fa3cc0 - middle::typeck::check::check_item::h22ee00fbae37d0570pW
  14:     0x7fba25fa79b0 - middle::typeck::check::check_item_types::h7de0aa0b52df316614V
  15:     0x7fba25a9c960 - &lt;unknown&gt;
  16:     0x7fba262c69f0 - middle::typeck::check_crate::hee34369af2a06be9Unp
  17:     0x7fba2632e290 - driver::driver::phase_3_run_analysis_passes::h44dc3d0e5ab4847dJ4B
  18:     0x7fba263292b0 - driver::driver::compile_input::hb7d473b561e2b247vLB
  19:     0x7fba263afb50 - &lt;unknown&gt;
  20:     0x7fba263afa40 - &lt;unknown&gt;
  21:     0x7fba25ab5f60 - &lt;unknown&gt;
  22:     0x7fba25ab5d50 - &lt;unknown&gt;
  23:     0x7fba26c0aa00 - &lt;unknown&gt;
  24:     0x7fba25706aa0 - &lt;unknown&gt;
  25:     0x7fba25706a90 - rust_try
  26:     0x7fba256a1d60 - unwind::try::h0709f530ff508047aYc
  27:     0x7fba256a1bf0 - task::Task::run::h3302eb43beb0760es4b
  28:     0x7fba26c0a740 - &lt;unknown&gt;
  29:     0x7fba256a3400 - &lt;unknown&gt;
  30:     0x7fba20872250 - start_thread
  31:     0x7fba2537d3b9 - clone
  32:                0x0 - &lt;unknown&gt;"><pre class="notranslate"><code class="notranslate">$ RUST_BACKTRACE=1 rustc a.rs 
a.rs:4:5: 4:6 error: internal compiler error: expected object type
a.rs:4     t as *mut Trait
           ^
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
task 'rustc' panicked at 'Box&lt;Any&gt;', /home/hein/git/rust/src/libsyntax/diagnostic.rs:116

stack backtrace:
   1:     0x7fba24ef8d50 - rt::backtrace::imp::write::h62769dcaa7983ed8FNs
   2:     0x7fba24efbdd0 - &lt;unknown&gt;
   3:     0x7fba256a43e0 - unwind::begin_unwind_inner::h3fca55fd1ce1f347o9c
   4:     0x7fba23e4f460 - &lt;unknown&gt;
   5:     0x7fba23e4f3e0 - diagnostic::SpanHandler::span_bug::hea3a64b392293aeaDRF
   6:     0x7fba25c49ad0 - driver::session::Session::span_bug::hb3878c8c794bf1dcHNC
   7:     0x7fba25f4a260 - middle::typeck::check::vtable::check_object_cast::h7d7ee59c0ae09980HKN
   8:     0x7fba25fb8090 - &lt;unknown&gt;
   9:     0x7fba25fe62b0 - &lt;unknown&gt;
  10:     0x7fba25fab4c0 - &lt;unknown&gt;
  11:     0x7fba25fa7eb0 - &lt;unknown&gt;
  12:     0x7fba25fa7bf0 - &lt;unknown&gt;
  13:     0x7fba25fa3cc0 - middle::typeck::check::check_item::h22ee00fbae37d0570pW
  14:     0x7fba25fa79b0 - middle::typeck::check::check_item_types::h7de0aa0b52df316614V
  15:     0x7fba25a9c960 - &lt;unknown&gt;
  16:     0x7fba262c69f0 - middle::typeck::check_crate::hee34369af2a06be9Unp
  17:     0x7fba2632e290 - driver::driver::phase_3_run_analysis_passes::h44dc3d0e5ab4847dJ4B
  18:     0x7fba263292b0 - driver::driver::compile_input::hb7d473b561e2b247vLB
  19:     0x7fba263afb50 - &lt;unknown&gt;
  20:     0x7fba263afa40 - &lt;unknown&gt;
  21:     0x7fba25ab5f60 - &lt;unknown&gt;
  22:     0x7fba25ab5d50 - &lt;unknown&gt;
  23:     0x7fba26c0aa00 - &lt;unknown&gt;
  24:     0x7fba25706aa0 - &lt;unknown&gt;
  25:     0x7fba25706a90 - rust_try
  26:     0x7fba256a1d60 - unwind::try::h0709f530ff508047aYc
  27:     0x7fba256a1bf0 - task::Task::run::h3302eb43beb0760es4b
  28:     0x7fba26c0a740 - &lt;unknown&gt;
  29:     0x7fba256a3400 - &lt;unknown&gt;
  30:     0x7fba20872250 - start_thread
  31:     0x7fba2537d3b9 - clone
  32:                0x0 - &lt;unknown&gt;
</code></pre></div>
<div class="highlight highlight-source-rust notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="fn foo(bar: *const u8) {
    let a = unsafe { (bar as *const Writer) };
}

fn main() {
}"><pre class="notranslate"><span class="pl-k">fn</span> <span class="pl-en">foo</span><span class="pl-kos">(</span><span class="pl-s1">bar</span><span class="pl-kos">:</span> <span class="pl-c1">*</span><span class="pl-k">const</span> <span class="pl-smi">u8</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-kos">(</span>bar <span class="pl-k">as</span> <span class="pl-c1">*</span><span class="pl-k">const</span> <span class="pl-smi">Writer</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-kos">}</span></pre></div>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="&lt;anon&gt;:3:23: 3:26 error: internal compiler error: expected object type
&lt;anon&gt;:3     let a = unsafe { (bar as *const Writer) };
                               ^~~
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
task 'rustc' panicked at 'Box&lt;Any&gt;', /build/rust-git/src/rust/src/libsyntax/diagnostic.rs:116"><pre class="notranslate"><code class="notranslate">&lt;anon&gt;:3:23: 3:26 error: internal compiler error: expected object type
&lt;anon&gt;:3     let a = unsafe { (bar as *const Writer) };
                               ^~~
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
task 'rustc' panicked at 'Box&lt;Any&gt;', /build/rust-git/src/rust/src/libsyntax/diagnostic.rs:116
</code></pre></div>