Add test to guard against VecDeque optimization regression
This commit is contained in:
parent
b757318718
commit
d5ec9af09d
17
tests/codegen/vecdeque-nonempty-get-no-panic.rs
Normal file
17
tests/codegen/vecdeque-nonempty-get-no-panic.rs
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
// Guards against regression for optimization discussed in issue #80836
|
||||||
|
|
||||||
|
// compile-flags: -O
|
||||||
|
// ignore-debug: the debug assertions get in the way
|
||||||
|
|
||||||
|
#![crate_type = "lib"]
|
||||||
|
|
||||||
|
use std::collections::VecDeque;
|
||||||
|
|
||||||
|
// CHECK-LABEL: @front
|
||||||
|
// CHECK: ret void
|
||||||
|
#[no_mangle]
|
||||||
|
pub fn front(v: VecDeque<usize>) {
|
||||||
|
if !v.is_empty() {
|
||||||
|
v.get(0).unwrap();
|
||||||
|
}
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user