]> git.lizzy.rs Git - rust.git/blob - src/test/ui/consts/const-eval/dangling.rs
Rollup merge of #70038 - DutchGhost:const-forget-tests, r=RalfJung
[rust.git] / src / test / ui / consts / const-eval / dangling.rs
1 #![feature(const_transmute, const_raw_ptr_deref)]
2
3 use std::{mem, usize};
4
5 // Make sure we error with the right kind of error on a too large slice.
6 const TEST: () = { unsafe { //~ NOTE
7     let slice: *const [u8] = mem::transmute((1usize, usize::MAX));
8     let _val = &*slice; //~ ERROR: any use of this value will cause an error
9     //~^ NOTE: slice is bigger than largest supported object
10     //~^^ on by default
11 } };
12
13 fn main() {}