Skip to content

Commit 46324c2

Browse files
authored
Merge pull request rust-lang#273 from RalfJung/ref
Test that &* of a dangling (and even unaligned) ptr is okay
2 parents 03ca15e + e5cc8aa commit 46324c2

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

tests/run-pass/ref-invalid-ptr.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
fn main() {
2+
let x = 2usize as *const u32;
3+
let _y = unsafe { &*x as *const u32 };
4+
5+
let x = 0usize as *const u32;
6+
let _y = unsafe { &*x as *const u32 };
7+
}

0 commit comments

Comments
 (0)