Closed
Description
Playpen: http://is.gd/BpXFCU
trait Foo {
fn get(&self) -> u32;
}
struct Bar {
something: u32
}
impl Foo for Bar {
fn get(&self) -> u32 {
self.something
}
}
fn main() {
let x = Bar { something: 4 };
let y = &x;
let z: *const Foo = y as *const _ as *const _;
let value = unsafe { (*z).get() };
println!("Hello, world! {}", value);
}
Outputs:
error: internal compiler error: translating unsupported cast: *const Bar (cast_pointer) -> *const Foo (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<Any>', /home/rustbuild/src/rust-buildbot/slave/beta-dist-rustc-linux/build/src/libsyntax/diagnostic.rs:209