Skip to content

Commit

Permalink
Add test to guard against VecDeque optimization regression
Browse files Browse the repository at this point in the history
  • Loading branch information
a-lafrance committed Sep 22, 2023
1 parent b757318 commit d5ec9af
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions tests/codegen/vecdeque-nonempty-get-no-panic.rs
Original file line number Diff line number Diff line change
@@ -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();
}
}

0 comments on commit d5ec9af

Please sign in to comment.