Skip to content

Commit f67af5a

Browse files
committed
test too big slice
1 parent 2bf8c3a commit f67af5a

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

tests/compile-fail/slice-too-big.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
use std::mem;
2+
use std::usize;
3+
4+
fn main() { unsafe {
5+
let ptr = Box::into_raw(Box::new(0u8));
6+
let _x: &[u8] = mem::transmute((ptr, usize::MAX)); //~ ERROR: invalid slice: total size is bigger than largest supported object
7+
} }

0 commit comments

Comments
 (0)