rust/src/test/ui/array-slice-vec/dst-raw-slice.rs

12 lines
218 B
Rust
Raw Normal View History

2014-09-01 23:25:01 +00:00
// Test bounds checking for DST raw slices
2020-04-16 06:50:32 +00:00
// run-fail
2014-09-01 23:25:01 +00:00
// error-pattern:index out of bounds
#[allow(unconditional_panic)]
2014-09-01 23:25:01 +00:00
fn main() {
2015-01-25 21:05:03 +00:00
let a: *const [_] = &[1, 2, 3];
2014-09-01 23:25:01 +00:00
unsafe {
let _b = (*a)[3];
}
}