rust/tests/codegen/issues/issue-110797-enum-jump-same.rs

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

26 lines
509 B
Rust
Raw Permalink Normal View History

2024-05-20 14:40:50 -05:00
//@ compile-flags: -O
#![crate_type = "lib"]
pub enum K {
2024-05-20 14:40:50 -05:00
A(Box<[i32]>),
B(Box<[u8]>),
C(Box<[String]>),
D(Box<[u16]>),
}
// CHECK-LABEL: @get_len
// CHECK-NEXT: {{.*}}:
// CHECK-NEXT: getelementptr inbounds
2024-06-11 02:45:16 -05:00
// CHECK-NEXT: load [[TYPE:i(32|64)]]
// CHECK-NEXT: ret [[TYPE]]
#[no_mangle]
pub fn get_len(arg: &K) -> usize {
2024-05-20 14:40:50 -05:00
match arg {
K::A(ref lst) => lst.len(),
K::B(ref lst) => lst.len(),
K::C(ref lst) => lst.len(),
K::D(ref lst) => lst.len(),
2024-05-20 14:40:50 -05:00
}
}