rust/tests/ui/array-slice-vec/dst-raw-slice.rs

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

14 lines
253 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
2020-05-07 15:39:02 +00:00
// ignore-emscripten no processes
#[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];
}
}