2023-09-18 11:29:50 -05:00
|
|
|
// Verify that `i32::cmp` FnDef type is declared with size 0 and align 1 in LLVM debuginfo.
|
|
|
|
//@ compile-flags: -O -g -Cno-prepopulate-passes
|
2023-10-08 11:43:57 -05:00
|
|
|
//@ ignore-msvc the types are mangled differently
|
2023-09-18 11:29:50 -05:00
|
|
|
|
|
|
|
use std::cmp::Ordering;
|
|
|
|
|
|
|
|
fn foo<F: FnOnce(&i32, &i32) -> Ordering>(v1: i32, v2: i32, compare: F) -> Ordering {
|
|
|
|
compare(&v1, &v2)
|
|
|
|
}
|
|
|
|
|
|
|
|
pub fn main() {
|
|
|
|
foo(0, 1, i32::cmp);
|
|
|
|
}
|
|
|
|
|
2024-02-23 23:48:20 -06:00
|
|
|
// CHECK: %compare.dbg.spill = alloca [0 x i8], align 1
|
2024-05-06 18:15:48 -05:00
|
|
|
// CHECK: dbg{{.}}declare({{(metadata )?}}ptr %compare.dbg.spill, {{(metadata )?}}![[VAR:.*]], {{(metadata )?}}!DIExpression()
|
2023-09-18 11:29:50 -05:00
|
|
|
// CHECK: ![[TYPE:.*]] = !DIDerivedType(tag: DW_TAG_pointer_type, name: "fn(&i32, &i32) -> core::cmp::Ordering", baseType: !{{.*}}, align: 1, dwarfAddressSpace: {{.*}})
|
|
|
|
// CHECK: ![[VAR]] = !DILocalVariable(name: "compare", scope: !{{.*}}, file: !{{.*}}, line: {{.*}}, type: ![[TYPE]], align: 1)
|