Skip to content

tests: Test line debuginfo for linebreaked function parameters #143880

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions tests/codegen/fn-parameters-on-different-lines-debuginfo.rs
Original file line number Diff line number Diff line change
@@ -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
Loading