mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-26 16:54:01 +00:00
14 lines
350 B
Rust
14 lines
350 B
Rust
const C: () = {
|
|
let value = [1, 2];
|
|
let ptr = value.as_ptr().wrapping_add(2);
|
|
let fat = std::ptr::slice_from_raw_parts(ptr, usize::MAX);
|
|
unsafe {
|
|
// This used to ICE, but it should just report UB.
|
|
let _ice = (*fat)[usize::MAX - 1];
|
|
//~^ERROR: constant value failed
|
|
//~| overflow
|
|
}
|
|
};
|
|
|
|
fn main() {}
|