rust/tests/ui/precondition-checks/misaligned-slice.rs
2024-02-16 20:02:50 +00:00

12 lines
313 B
Rust

//@ run-fail
//@ compile-flags: -Copt-level=3 -Cdebug-assertions=yes
//@ error-pattern: unsafe precondition(s) violated: slice::from_raw_parts
//@ ignore-debug
//@ ignore-wasm32-bare no panic messages
fn main() {
unsafe {
let _s: &[u64] = std::slice::from_raw_parts(1usize as *const u64, 0);
}
}