Skip to content

Commit 500b743

Browse files
committed
tests: Test line debuginfo for linebreaked function parameters
1 parent 855e0fe commit 500b743

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
//! Make sure that line debuginfo of function parameters are correct even if
2+
//! they are not on the same line. Regression test for
3+
// <https://github.com/rust-lang/rust/issues/45010>.
4+
5+
//@ compile-flags: -g -Copt-level=0
6+
7+
#[rustfmt::skip] // Having parameters on different lines is crucial for this test.
8+
pub fn foo(
9+
x_parameter_not_in_std: i32,
10+
y_parameter_not_in_std: i32,
11+
) -> i32 {
12+
x_parameter_not_in_std + y_parameter_not_in_std
13+
}
14+
15+
fn main() {
16+
foo(42, 43); // Ensure `wasm32-wasip1` keeps `foo()` (even if `-Copt-level=0`)
17+
}
18+
19+
// CHECK: !DILocalVariable(name: "x_parameter_not_in_std", arg: 1,
20+
// CHECK-SAME: line: 9
21+
// CHECK: !DILocalVariable(name: "y_parameter_not_in_std", arg: 2,
22+
// CHECK-SAME: line: 10

0 commit comments

Comments
 (0)