about summary refs log tree commit diff
diff options
context:
space:
mode:
authorMartin Nordholts <martin.nordholts@codetale.se>2025-07-13 12:11:37 +0200
committerMartin Nordholts <martin.nordholts@codetale.se>2025-07-14 07:11:57 +0200
commit500b743f7ef8e38a0ad6154493a84c53e06ea888 (patch)
treee1725458eed0e5b07ca1e78c0bf5856006d10c75
parent855e0fe46e68d94e9f6147531b75ac2d488c548e (diff)
downloadrust-500b743f7ef8e38a0ad6154493a84c53e06ea888.tar.gz
rust-500b743f7ef8e38a0ad6154493a84c53e06ea888.zip
tests: Test line debuginfo for linebreaked function parameters
-rw-r--r--tests/codegen/fn-parameters-on-different-lines-debuginfo.rs22
1 files changed, 22 insertions, 0 deletions
diff --git a/tests/codegen/fn-parameters-on-different-lines-debuginfo.rs b/tests/codegen/fn-parameters-on-different-lines-debuginfo.rs
new file mode 100644
index 00000000000..2097567f322
--- /dev/null
+++ b/tests/codegen/fn-parameters-on-different-lines-debuginfo.rs
@@ -0,0 +1,22 @@
+//! Make sure that line debuginfo of function parameters are correct even if
+//! they are not on the same line. Regression test for
+// <https://github.com/rust-lang/rust/issues/45010>.
+
+//@ compile-flags: -g -Copt-level=0
+
+#[rustfmt::skip] // Having parameters on different lines is crucial for this test.
+pub fn foo(
+    x_parameter_not_in_std: i32,
+    y_parameter_not_in_std: i32,
+) -> i32 {
+    x_parameter_not_in_std + y_parameter_not_in_std
+}
+
+fn main() {
+    foo(42, 43); // Ensure `wasm32-wasip1` keeps `foo()` (even if `-Copt-level=0`)
+}
+
+// CHECK: !DILocalVariable(name: "x_parameter_not_in_std", arg: 1,
+// CHECK-SAME: line: 9
+// CHECK: !DILocalVariable(name: "y_parameter_not_in_std", arg: 2,
+// CHECK-SAME: line: 10