]> git.lizzy.rs Git - rust.git/blob - src/test/codegen/enum-bounds-check-issue-13926.rs
Added docs to internal_macro const
[rust.git] / src / test / codegen / enum-bounds-check-issue-13926.rs
1 // This test checks an optimization that is not guaranteed to work. This test case should not block
2 // a future LLVM update.
3 // compile-flags: -O
4 // min-llvm-version: 11.0
5
6 #![crate_type = "lib"]
7
8 #[repr(u8)]
9 pub enum Exception {
10     Low = 5,
11     High = 10,
12 }
13
14 // CHECK-LABEL: @access
15 #[no_mangle]
16 pub fn access(array: &[usize; 12], exc: Exception) -> usize {
17     // CHECK-NOT: panic_bounds_check
18     array[(exc as u8 - 4) as usize]
19 }