Skip to content

Commit a090edb

Browse files
committed
explain a test
1 parent 791f464 commit a090edb

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

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

+2
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)