mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-01 15:01:51 +00:00
20 lines
429 B
Rust
20 lines
429 B
Rust
|
// This test checks that `VecDeque::front[_mut]()` and `VecDeque::back[_mut]()` can't panic.
|
||
|
|
||
|
// compile-flags: -O
|
||
|
// ignore-debug: the debug assertions get in the way
|
||
|
|
||
|
#![crate_type = "lib"]
|
||
|
|
||
|
use std::collections::VecDeque;
|
||
|
|
||
|
// CHECK-LABEL: @dont_panic
|
||
|
#[no_mangle]
|
||
|
pub fn dont_panic(v: &mut VecDeque<usize>) {
|
||
|
// CHECK-NOT: expect
|
||
|
// CHECK-NOT: panic
|
||
|
v.front();
|
||
|
v.front_mut();
|
||
|
v.back();
|
||
|
v.back_mut();
|
||
|
}
|