]> git.lizzy.rs Git - rust.git/blob - src/tools/miri/tests/fail/dyn-call-trait-mismatch.rs
Rollup merge of #102187 - b-naber:inline-const-source-info, r=eholk
[rust.git] / src / tools / miri / tests / fail / dyn-call-trait-mismatch.rs
1 trait T1 {
2     fn method1(self: Box<Self>);
3 }
4 trait T2 {
5     fn method2(self: Box<Self>);
6 }
7
8 impl T1 for i32 {
9     fn method1(self: Box<Self>) {}
10 }
11
12 fn main() {
13     let r = Box::new(0) as Box<dyn T1>;
14     let r2: Box<dyn T2> = unsafe { std::mem::transmute(r) };
15     r2.method2(); //~ERROR: call on a pointer whose vtable does not match its type
16 }