blob: 7ac619e09abf6f60faa1d530e44c2333cc2b460a [file] [log] [blame]
// Validation and SB stop this too early.
//@compile-flags: -Zmiri-disable-validation -Zmiri-disable-stacked-borrows
trait T1 {
#[allow(dead_code)]
fn method1(self: Box<Self>);
}
trait T2 {
fn method2(self: Box<Self>);
}
impl T1 for i32 {
fn method1(self: Box<Self>) {}
}
fn main() {
let r = Box::new(0) as Box<dyn T1>;
let r2: Box<dyn T2> = unsafe { std::mem::transmute(r) };
r2.method2(); //~ERROR: using vtable for `T1` but `T2` was expected
}