rust/tests/fail/stacked_borrows/zst_slice.rs

12 lines
277 B
Rust
Raw Normal View History

2022-07-08 11:08:32 -05:00
//@compile-flags: -Zmiri-strict-provenance
2022-07-13 17:59:33 -05:00
//@error-pattern: /reborrow .* tag does not exist in the borrow stack/
fn main() {
unsafe {
let a = [1, 2, 3];
let s = &a[0..0];
assert_eq!(s.len(), 0);
assert_eq!(*s.get_unchecked(1), 2);
}
}