rust/tests/fail/validity/invalid_wide_raw.rs

12 lines
284 B
Rust
Raw Normal View History

#![allow(invalid_value)]
2019-08-25 07:56:38 -05:00
fn main() {
trait T {}
2019-08-25 07:56:38 -05:00
#[derive(Debug)]
struct S {
#[allow(dead_code)]
x: *mut dyn T,
2019-08-25 07:56:38 -05:00
}
2022-07-18 09:38:26 -05:00
dbg!(S { x: unsafe { std::mem::transmute((0usize, 0usize)) } }); //~ ERROR: encountered null pointer, but expected a vtable pointer
2019-08-25 07:56:38 -05:00
}