Skip to content

Commit

Permalink
test too big slice
Browse files Browse the repository at this point in the history
  • Loading branch information
RalfJung committed Aug 27, 2019
1 parent 2be0db4 commit 2cee141
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions tests/compile-fail/slice-too-big.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
use std::mem;
use std::usize;

fn main() { unsafe {
let ptr = Box::into_raw(Box::new(0u8));
let _x: &[u8] = mem::transmute((ptr, usize::MAX)); //~ ERROR: invalid slice: total size is bigger than largest supported object
} }

0 comments on commit 2cee141

Please sign in to comment.