rust/tests/codegen/issues/issue-110797-enum-jump-same.rs
2024-09-18 13:53:31 -07:00

26 lines
509 B
Rust

//@ compile-flags: -O
#![crate_type = "lib"]
pub enum K {
A(Box<[i32]>),
B(Box<[u8]>),
C(Box<[String]>),
D(Box<[u16]>),
}
// CHECK-LABEL: @get_len
// CHECK-NEXT: {{.*}}:
// CHECK-NEXT: getelementptr inbounds
// CHECK-NEXT: load [[TYPE:i(32|64)]]
// CHECK-NEXT: ret [[TYPE]]
#[no_mangle]
pub fn get_len(arg: &K) -> usize {
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(),
}
}