Skip to content

Commit 6f793d9

Browse files
committed
explain a test
1 parent 81fad48 commit 6f793d9

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
fn main() {
22
let x = 2usize as *const u32;
3+
// this is not aligned, but we immediately cast it to a raw ptr so that must be okay
34
let _y = unsafe { &*x as *const u32 };
45

56
let x = 0usize as *const u32;
7+
// this is NULL, but we immediately cast it to a raw ptr so that must be okay
68
let _y = unsafe { &*x as *const u32 };
79
}

0 commit comments

Comments
 (0)