diff --git a/tests/run-pass/deref_partially_dangling_raw.rs b/tests/run-pass/deref_partially_dangling_raw.rs new file mode 100644 index 000000000000..8639a289363b --- /dev/null +++ b/tests/run-pass/deref_partially_dangling_raw.rs @@ -0,0 +1,9 @@ +// Deref a raw ptr to access a field of a large struct, where the field +// is allocated but not the entire struct is. +// For now, we want to allow this. + +fn main() { + let x = (1, 1); + let xptr = &x as *const _ as *const (i32, i32, i32); + let _val = unsafe { (*xptr).1 }; +}