rust/tests/fail/validity/invalid_wide_raw.rs

12 lines
281 B
Rust
Raw Normal View History

#![allow(invalid_value)]
2019-08-25 07:56:38 -05:00
fn main() {
trait T { }
#[derive(Debug)]
struct S {
#[allow(dead_code)]
2019-08-25 07:56:38 -05:00
x: * mut dyn T
}
2020-05-08 06:56:10 -05:00
dbg!(S { x: unsafe { std::mem::transmute((0usize, 0usize)) } }); //~ ERROR: encountered dangling vtable pointer in wide pointer
2019-08-25 07:56:38 -05:00
}