Skip to content

Commit 3a5c44c

Browse files
committed
Auto merge of #929 - RalfJung:slice-too-big, r=RalfJung
test too big slice Test for an upcoming rustc PR.
2 parents 2bf8c3a + dfca026 commit 3a5c44c

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

rust-version

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
7445622bcb515c822a2fc6e8c57c90478c1a56bb
1+
2d851b33181b1404856cb1d8b20d261adda54ffb

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)