<p dir="auto">Hi folks,</p>
<p dir="auto">I'm getting an ICE from the following code fragment:</p>
<div class="highlight highlight-source-rust notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="let xy: Vec&lt;u8&gt; = vec![0,1,2,3];
let slice = xy.as_ptr() as *const [u8];"><pre class="notranslate"><span class="pl-k">let</span> xy<span class="pl-kos">:</span> <span class="pl-smi">Vec</span><span class="pl-kos">&lt;</span><span class="pl-smi">u8</span><span class="pl-kos">&gt;</span> = <span class="pl-en">vec</span><span class="pl-en">!</span><span class="pl-kos">[</span><span class="pl-c1">0</span>,<span class="pl-c1">1</span>,<span class="pl-c1">2</span>,<span class="pl-c1">3</span><span class="pl-kos">]</span><span class="pl-kos">;</span>
<span class="pl-k">let</span> slice = xy<span class="pl-kos">.</span><span class="pl-en">as_ptr</span><span class="pl-kos">(</span><span class="pl-kos">)</span> <span class="pl-k">as</span> <span class="pl-c1">*</span><span class="pl-k">const</span> <span class="pl-kos">[</span><span class="pl-smi">u8</span><span class="pl-kos">]</span><span class="pl-kos">;</span></pre></div>
<p dir="auto">rustc version is</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="workstation:~# rustc --version
rustc 1.0.0-nightly (2baf34825 2015-04-21) (built 2015-04-22)"><pre class="notranslate"><code class="notranslate">workstation:~# rustc --version
rustc 1.0.0-nightly (2baf34825 2015-04-21) (built 2015-04-22)
</code></pre></div>
<p dir="auto">backtrace results:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="arena_tests.rs:49   let slice = xy.as_ptr() as *const [u8];
                        ^~~~~
error: internal compiler error: translating unsupported cast: *const u8 (cast_pointer) -&gt; *const [u8] (cast_other)
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 'Box&lt;Any&gt;', /home/rustbuild/src/rust-buildbot/slave/nightly-dist-rustc-linux/build/src/libsyntax/diagnostic.rs:209

stack backtrace:
   1:     0x7f5a17169bb9 - sys::backtrace::write::he1173a406c2335a83JC
   2:     0x7f5a1718e4b7 - panicking::on_panic::hfd4f10113591c07f9aJ
   3:     0x7f5a170d8322 - rt::unwind::begin_unwind_inner::h5dd2f870d997f851hQI
   4:     0x7f5a1466f8ad - rt::unwind::begin_unwind::h11948444363592342521
   5:     0x7f5a1466ff6b - diagnostic::Handler::bug::h8b610b99ced770c3AtB
   6:     0x7f5a1504ae6b - session::Session::bug::h9b57e3cf31a5ccf02Sq
   7:     0x7f5a168c5b37 - trans::expr::trans_imm_cast::hcc8d7dfc4709cde4XCC
   8:     0x7f5a168b9897 - trans::expr::trans_unadjusted::hf7cee925729ae17cJQA
   9:     0x7f5a1688f088 - trans::expr::trans_into::h6ab0ed2ab3f50b9a67z
  10:     0x7f5a1691005a - trans::_match::mk_binding_alloca::h7975878531167784623
  11:     0x7f5a167fd05e - trans::base::init_local::h091fe6ffe939a1f5VWg
  12:     0x7f5a1680d8ee - trans::controlflow::trans_block::h4cc709c0c234a1a9f5u
  13:     0x7f5a1680c6b1 - trans::base::trans_closure::hca42661a4cb8808aYDh
  14:     0x7f5a1680e1da - trans::base::trans_fn::h8c8ad1cfb018c3d1IOh
  15:     0x7f5a16811267 - trans::base::trans_item::h5f366b9cf5915577Yci
  16:     0x7f5a1681fadd - trans::base::trans_crate::h4d51da86e796d34d31i
  17:     0x7f5a177e20fa - driver::phase_4_translate_to_llvm::hb8e4f02386630e0djOa
  18:     0x7f5a177b9f4a - driver::compile_input::h7fb56cda9a0f227dQba
  19:     0x7f5a17878711 - run_compiler::hbdd9b2c4cacce291L4b
  20:     0x7f5a17876362 - boxed::F.FnBox&lt;A&gt;::call_box::h9433597520612747
  21:     0x7f5a17875899 - rt::unwind::try::try_fn::h10263588931191114294
  22:     0x7f5a17204348 - rust_try_inner
  23:     0x7f5a17204335 - rust_try
  24:     0x7f5a17875b48 - boxed::F.FnBox&lt;A&gt;::call_box::h17081069488870149893
  25:     0x7f5a1717be41 - sys::thread::create::thread_start::hb84d91b7ff5c0ddcrLH
  26:     0x7f5a111580a4 - start_thread
  27:     0x7f5a16d42cfc - __clone
  28:                0x0 - &lt;unknown&gt;
"><pre class="notranslate"><code class="notranslate">arena_tests.rs:49   let slice = xy.as_ptr() as *const [u8];
                        ^~~~~
error: internal compiler error: translating unsupported cast: *const u8 (cast_pointer) -&gt; *const [u8] (cast_other)
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 'Box&lt;Any&gt;', /home/rustbuild/src/rust-buildbot/slave/nightly-dist-rustc-linux/build/src/libsyntax/diagnostic.rs:209

stack backtrace:
   1:     0x7f5a17169bb9 - sys::backtrace::write::he1173a406c2335a83JC
   2:     0x7f5a1718e4b7 - panicking::on_panic::hfd4f10113591c07f9aJ
   3:     0x7f5a170d8322 - rt::unwind::begin_unwind_inner::h5dd2f870d997f851hQI
   4:     0x7f5a1466f8ad - rt::unwind::begin_unwind::h11948444363592342521
   5:     0x7f5a1466ff6b - diagnostic::Handler::bug::h8b610b99ced770c3AtB
   6:     0x7f5a1504ae6b - session::Session::bug::h9b57e3cf31a5ccf02Sq
   7:     0x7f5a168c5b37 - trans::expr::trans_imm_cast::hcc8d7dfc4709cde4XCC
   8:     0x7f5a168b9897 - trans::expr::trans_unadjusted::hf7cee925729ae17cJQA
   9:     0x7f5a1688f088 - trans::expr::trans_into::h6ab0ed2ab3f50b9a67z
  10:     0x7f5a1691005a - trans::_match::mk_binding_alloca::h7975878531167784623
  11:     0x7f5a167fd05e - trans::base::init_local::h091fe6ffe939a1f5VWg
  12:     0x7f5a1680d8ee - trans::controlflow::trans_block::h4cc709c0c234a1a9f5u
  13:     0x7f5a1680c6b1 - trans::base::trans_closure::hca42661a4cb8808aYDh
  14:     0x7f5a1680e1da - trans::base::trans_fn::h8c8ad1cfb018c3d1IOh
  15:     0x7f5a16811267 - trans::base::trans_item::h5f366b9cf5915577Yci
  16:     0x7f5a1681fadd - trans::base::trans_crate::h4d51da86e796d34d31i
  17:     0x7f5a177e20fa - driver::phase_4_translate_to_llvm::hb8e4f02386630e0djOa
  18:     0x7f5a177b9f4a - driver::compile_input::h7fb56cda9a0f227dQba
  19:     0x7f5a17878711 - run_compiler::hbdd9b2c4cacce291L4b
  20:     0x7f5a17876362 - boxed::F.FnBox&lt;A&gt;::call_box::h9433597520612747
  21:     0x7f5a17875899 - rt::unwind::try::try_fn::h10263588931191114294
  22:     0x7f5a17204348 - rust_try_inner
  23:     0x7f5a17204335 - rust_try
  24:     0x7f5a17875b48 - boxed::F.FnBox&lt;A&gt;::call_box::h17081069488870149893
  25:     0x7f5a1717be41 - sys::thread::create::thread_start::hb84d91b7ff5c0ddcrLH
  26:     0x7f5a111580a4 - start_thread
  27:     0x7f5a16d42cfc - __clone
  28:                0x0 - &lt;unknown&gt;

</code></pre></div>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="extern crate libc;

fn main() {
    unsafe {
        let data = libc::malloc(100);
        let data_vec = data as *mut [u8];
    }
}"><pre class="notranslate"><code class="notranslate">extern crate libc;

fn main() {
    unsafe {
        let data = libc::malloc(100);
        let data_vec = data as *mut [u8];
    }
}
</code></pre></div>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="$ rustc --version
rustc 1.0.0-nightly (890293655 2015-02-28) (built 2015-03-01)"><pre class="notranslate"><code class="notranslate">$ rustc --version
rustc 1.0.0-nightly (890293655 2015-02-28) (built 2015-03-01)
</code></pre></div>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="$ RUST_BACKTRACE=1 rustc 1.rs 
1.rs:1:1: 1:19 warning: use of unstable library feature 'libc'
1.rs:1 extern crate libc;
       ^~~~~~~~~~~~~~~~~~
1.rs:1:1: 1:19 help: add #![feature(libc)] to the crate attributes to silence this warning
1.rs:1 extern crate libc;
       ^~~~~~~~~~~~~~~~~~
1.rs:5:20: 5:32 warning: use of unstable library feature 'libc'
1.rs:5         let data = libc::malloc(100);
                          ^~~~~~~~~~~~
1.rs:5:20: 5:32 help: add #![feature(libc)] to the crate attributes to silence this warning
1.rs:5         let data = libc::malloc(100);
                          ^~~~~~~~~~~~
1.rs:6:13: 6:21 warning: unused variable: `data_vec`, #[warn(unused_variables)] on by default
1.rs:6         let data_vec = data as *mut [u8];
                   ^~~~~~~~
error: internal compiler error: translating unsupported cast: *mut libc::types::common::c95::c_void (cast_pointer) -&gt; *mut [u8] (cast_other)
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 'Box&lt;Any&gt;', /home/rustbuild/src/rust-buildbot/slave/nightly-dist-rustc-linux/build/src/libsyntax/diagnostic.rs:189

stack backtrace:
   1:         0x61ef7c4f - sys::backtrace::write::hb08af03691eab78a5kA
   2:         0x61f20782 - panicking::on_panic::h37164609ca1c02afBnJ
   3:         0x61e6063a - rt::unwind::begin_unwind_inner::h24d5e7492198457b43I
   4:         0x5f189a8d - rt::unwind::begin_unwind::h9113908695753286194
   5:         0x5f18a2c5 - diagnostic::Handler::bug::h35ee8d5e5a4a01aeCHD
   6:         0x5fcaa9fb - session::Session::bug::hf545afa75e911993uwp
   7:         0x615e1650 - trans::expr::trans_imm_cast::h267a0afdb72de17aLPj
   8:         0x615cc199 - trans::expr::trans_unadjusted::h195794326d4a3453m4h
   9:         0x615835bf - trans::expr::trans_into::h4bccf2ad56ca2eb8mnh
  10:         0x6168307e - trans::_match::mk_binding_alloca::h11720668362277363266
  11:         0x6158281d - trans::base::init_local::h445e388f28d5f2ddMps
  12:         0x61583fe2 - trans::controlflow::trans_block::hac110643148141f4T4d
  13:         0x615cd7ae - trans::expr::trans_rvalue_dps_unadjusted::h98f8f68155d4ea21Rzi
  14:         0x6158359e - trans::expr::trans_into::h4bccf2ad56ca2eb8mnh
  15:         0x61584307 - trans::controlflow::trans_block::hac110643148141f4T4d
  16:         0x6164f7ef - trans::base::trans_closure::hf74692cb2d4d8ab8wct
  17:         0x61570538 - trans::base::trans_fn::hd3b302f8da4ef8d2pnt
  18:         0x6156c107 - trans::base::trans_item::h43df28c38e89c2c1hLt
  19:         0x616562fc - trans::base::trans_crate::h6e541e412696da41RGu
  20:         0x62581fd2 - driver::phase_4_translate_to_llvm::h39966ab909496f1crNa
  21:         0x6255d5c8 - driver::compile_input::hee81c045ab46c74fIba
  22:         0x62627e6e - run_compiler::h875c1e123fe4ae2cF5b
  23:         0x62625a1c - thunk::F.Invoke&lt;A, R&gt;::invoke::h12424714292252424185
  24:         0x62624770 - rt::unwind::try::try_fn::h4021821266450575721
  25:         0x61f8bfe8 - rust_try_inner
  26:         0x61f8bfd5 - rust_try
  27:         0x62624e5c - thunk::F.Invoke&lt;A, R&gt;::invoke::h8199562432922027576
  28:         0x61f0c2d5 - sys::thread::thread_start::h1b1bb1e7ac08d3a6yRE
  29:         0x5bc420a3 - start_thread
  30:         0x61adfccc - __clone
  31:         0xffffffff - &lt;unknown&gt;"><pre class="notranslate"><code class="notranslate">$ RUST_BACKTRACE=1 rustc 1.rs 
1.rs:1:1: 1:19 warning: use of unstable library feature 'libc'
1.rs:1 extern crate libc;
       ^~~~~~~~~~~~~~~~~~
1.rs:1:1: 1:19 help: add #![feature(libc)] to the crate attributes to silence this warning
1.rs:1 extern crate libc;
       ^~~~~~~~~~~~~~~~~~
1.rs:5:20: 5:32 warning: use of unstable library feature 'libc'
1.rs:5         let data = libc::malloc(100);
                          ^~~~~~~~~~~~
1.rs:5:20: 5:32 help: add #![feature(libc)] to the crate attributes to silence this warning
1.rs:5         let data = libc::malloc(100);
                          ^~~~~~~~~~~~
1.rs:6:13: 6:21 warning: unused variable: `data_vec`, #[warn(unused_variables)] on by default
1.rs:6         let data_vec = data as *mut [u8];
                   ^~~~~~~~
error: internal compiler error: translating unsupported cast: *mut libc::types::common::c95::c_void (cast_pointer) -&gt; *mut [u8] (cast_other)
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 'Box&lt;Any&gt;', /home/rustbuild/src/rust-buildbot/slave/nightly-dist-rustc-linux/build/src/libsyntax/diagnostic.rs:189

stack backtrace:
   1:         0x61ef7c4f - sys::backtrace::write::hb08af03691eab78a5kA
   2:         0x61f20782 - panicking::on_panic::h37164609ca1c02afBnJ
   3:         0x61e6063a - rt::unwind::begin_unwind_inner::h24d5e7492198457b43I
   4:         0x5f189a8d - rt::unwind::begin_unwind::h9113908695753286194
   5:         0x5f18a2c5 - diagnostic::Handler::bug::h35ee8d5e5a4a01aeCHD
   6:         0x5fcaa9fb - session::Session::bug::hf545afa75e911993uwp
   7:         0x615e1650 - trans::expr::trans_imm_cast::h267a0afdb72de17aLPj
   8:         0x615cc199 - trans::expr::trans_unadjusted::h195794326d4a3453m4h
   9:         0x615835bf - trans::expr::trans_into::h4bccf2ad56ca2eb8mnh
  10:         0x6168307e - trans::_match::mk_binding_alloca::h11720668362277363266
  11:         0x6158281d - trans::base::init_local::h445e388f28d5f2ddMps
  12:         0x61583fe2 - trans::controlflow::trans_block::hac110643148141f4T4d
  13:         0x615cd7ae - trans::expr::trans_rvalue_dps_unadjusted::h98f8f68155d4ea21Rzi
  14:         0x6158359e - trans::expr::trans_into::h4bccf2ad56ca2eb8mnh
  15:         0x61584307 - trans::controlflow::trans_block::hac110643148141f4T4d
  16:         0x6164f7ef - trans::base::trans_closure::hf74692cb2d4d8ab8wct
  17:         0x61570538 - trans::base::trans_fn::hd3b302f8da4ef8d2pnt
  18:         0x6156c107 - trans::base::trans_item::h43df28c38e89c2c1hLt
  19:         0x616562fc - trans::base::trans_crate::h6e541e412696da41RGu
  20:         0x62581fd2 - driver::phase_4_translate_to_llvm::h39966ab909496f1crNa
  21:         0x6255d5c8 - driver::compile_input::hee81c045ab46c74fIba
  22:         0x62627e6e - run_compiler::h875c1e123fe4ae2cF5b
  23:         0x62625a1c - thunk::F.Invoke&lt;A, R&gt;::invoke::h12424714292252424185
  24:         0x62624770 - rt::unwind::try::try_fn::h4021821266450575721
  25:         0x61f8bfe8 - rust_try_inner
  26:         0x61f8bfd5 - rust_try
  27:         0x62624e5c - thunk::F.Invoke&lt;A, R&gt;::invoke::h8199562432922027576
  28:         0x61f0c2d5 - sys::thread::thread_start::h1b1bb1e7ac08d3a6yRE
  29:         0x5bc420a3 - start_thread
  30:         0x61adfccc - __clone
  31:         0xffffffff - &lt;unknown&gt;
</code></pre></div>