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-02 11:25:01 +12:00
// Test bounds checking for DST raw slices
2020-04-16 15:50:32 +09:00
// run-fail
2014-09-02 11:25:01 +12:00
// error-pattern:index out of bounds
2020-05-08 00:39:02 +09:00
// ignore-emscripten no processes
#[allow(unconditional_panic)]
2014-09-02 11:25:01 +12:00
fn main() {
2015-01-25 22:05:03 +01:00
let a: *const [_] = &[1, 2, 3];
2014-09-02 11:25:01 +12:00
unsafe {
let _b = (*a)[3];
}
}