mirror of
https://github.com/rust-lang/rust.git
synced 2024-10-30 14:01:51 +00:00
Add codegen test for #111508
This commit is contained in:
parent
beabc5647b
commit
15d07fb2cb
22
tests/codegen/issues/issue-111508-vec-tryinto-array.rs
Normal file
22
tests/codegen/issues/issue-111508-vec-tryinto-array.rs
Normal file
@ -0,0 +1,22 @@
|
||||
//@ compile-flags: -O
|
||||
// This regress since Rust version 1.72.
|
||||
//@ min-llvm-version: 18.1.4
|
||||
|
||||
#![crate_type = "lib"]
|
||||
|
||||
use std::convert::TryInto;
|
||||
|
||||
const N: usize = 24;
|
||||
|
||||
#[no_mangle]
|
||||
// CHECK-LABEL: @example
|
||||
// CHECK-NOT: unwrap_failed
|
||||
pub fn example(a: Vec<u8>) -> u8 {
|
||||
if a.len() != 32 {
|
||||
return 0;
|
||||
}
|
||||
|
||||
let a: [u8; 32] = a.try_into().unwrap();
|
||||
|
||||
a[15] + a[N]
|
||||
}
|
Loading…
Reference in New Issue
Block a user