rust/tests/ui/precondition-checks/misaligned-slice.rs

11 lines
287 B
Rust
Raw Normal View History

//@ run-fail
//@ compile-flags: -Copt-level=3 -Cdebug-assertions=no -Zub-checks=yes
//@ error-pattern: unsafe precondition(s) violated: slice::from_raw_parts
//@ ignore-debug
2024-02-07 09:30:11 -06:00
fn main() {
unsafe {
let _s: &[u64] = std::slice::from_raw_parts(1usize as *const u64, 0);
}
}