File tree Expand file tree Collapse file tree 1 file changed +38
-0
lines changed Expand file tree Collapse file tree 1 file changed +38
-0
lines changed Original file line number Diff line number Diff line change 1+ /// Make sure that line debuginfo is correct for diverging calls under certain
2+ /// conditions. In particular we want to ensure that the line number is never
3+ /// 0, but we check the absence of 0 by looking for the expected exact line
4+ /// numbers. Regression test for <https://github.com/rust-lang/rust/issues/59558>.
5+
6+ //@ compile-flags: -g -Clto -Copt-level=0
7+ //@ no-prefer-dynamic
8+
9+ // First find the scope of both diverge() calls, namely this main() function.
10+ // CHECK-DAG: [[MAIN_SCOPE:![0-9]+]] = distinct !DISubprogram(name: "main", linkageName: {{.*}}diverging_function_call_debuginfo{{.*}}main{{.*}}
11+ fn main ( ) {
12+ if True == False {
13+ // unreachable
14+ // Then find the DILocation with the correct line number for this call ...
15+ // CHECK-DAG: [[UNREACHABLE_CALL_DBG:![0-9]+]] = !DILocation(line: [[@LINE+1]], {{.*}}scope: [[MAIN_SCOPE]]
16+ diverge ( ) ;
17+ }
18+
19+ // ... and this call.
20+ // CHECK-DAG: [[LAST_CALL_DBG:![0-9]+]] = !DILocation(line: [[@LINE+1]], {{.*}}scope: [[MAIN_SCOPE]]
21+ diverge ( ) ;
22+ }
23+
24+ #[ derive( PartialEq ) ]
25+ pub enum MyBool {
26+ True ,
27+ False ,
28+ }
29+
30+ use MyBool :: * ;
31+
32+ fn diverge ( ) -> ! {
33+ panic ! ( ) ;
34+ }
35+
36+ // Finally make sure both DILocations belong to each the respective diverge() call.
37+ // CHECK-DAG: call void {{.*}}diverging_function_call_debuginfo{{.*}}diverge{{.*}} !dbg [[LAST_CALL_DBG]]
38+ // CHECK-DAG: call void {{.*}}diverging_function_call_debuginfo{{.*}}diverge{{.*}} !dbg [[UNREACHABLE_CALL_DBG]]
You can’t perform that action at this time.
0 commit comments