mirror of
https://github.com/rust-lang/rust.git
synced 2025-11-30 21:48:28 +00:00
Most of these regressions concern elimination of panics and bounds checks that were fixed upstream by LLVM.
20 lines
422 B
Rust
20 lines
422 B
Rust
// Tests that the `unwrap` branch is optimized out from the `pop` since the
|
|
// length has already been validated.
|
|
|
|
//@ compile-flags: -Copt-level=3
|
|
|
|
#![crate_type = "lib"]
|
|
|
|
pub enum Foo {
|
|
First(usize),
|
|
Second(usize),
|
|
}
|
|
|
|
// CHECK-LABEL: @check_only_one_panic
|
|
#[no_mangle]
|
|
pub fn check_only_one_panic(v: &mut Vec<Foo>) -> Foo {
|
|
// CHECK-COUNT-1: call{{.+}}panic
|
|
assert!(v.len() == 1);
|
|
v.pop().unwrap()
|
|
}
|