Skip to content

Commit

Permalink
Test that &* of a dangling (and even unaligned) ptr is okay
Browse files Browse the repository at this point in the history
  • Loading branch information
RalfJung committed Jul 26, 2017
1 parent 03ca15e commit e5cc8aa
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions tests/run-pass/ref-invalid-ptr.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
fn main() {
let x = 2usize as *const u32;
let _y = unsafe { &*x as *const u32 };

let x = 0usize as *const u32;
let _y = unsafe { &*x as *const u32 };
}

0 comments on commit e5cc8aa

Please sign in to comment.