File: fn-parameters-on-different-lines-debuginfo.rs

package info (click to toggle)
rustc 1.90.0%2Bdfsg1-1~bpo13%2B2
  • links: PTS, VCS
  • area: main
  • in suites: trixie-backports
  • size: 925,944 kB
  • sloc: xml: 158,148; javascript: 19,781; sh: 19,174; python: 15,732; ansic: 13,096; cpp: 7,181; asm: 4,376; makefile: 697; lisp: 176; sql: 15
file content (22 lines) | stat: -rw-r--r-- 729 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
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