rust/tests/debuginfo/closure-in-generic-function.rs
Martin Nordholts 5b57d02e9f compiletest: Use //@ prefixes also for debuginfo test directives
So that when we later add support for revisions we can use the same
syntax for revisions as elsewhere.

This also prevents people from making typos for commands since
`src/tools/compiletest/src/directives/directive_names.rs` will catch such
typos now.

Note that we one FIXME for a non-trivial change for later:
```
// FIXME(148097): Change `// cdb-checksimple_closure` to `//@ cdb-check:simple_closure`
```
2025-11-25 06:13:45 +01:00

53 lines
1 KiB
Rust

//@ compile-flags:-g
//@ disable-gdb-pretty-printers
//@ ignore-backends: gcc
// === GDB TESTS ===================================================================================
//@ gdb-command:run
//@ gdb-command:print x
//@ gdb-check:$1 = 0.5
//@ gdb-command:print y
//@ gdb-check:$2 = 10
//@ gdb-command:continue
//@ gdb-command:print *x
//@ gdb-check:$3 = 29
//@ gdb-command:print *y
//@ gdb-check:$4 = 110
//@ gdb-command:continue
// === LLDB TESTS ==================================================================================
//@ lldb-command:run
//@ lldb-command:v x
//@ lldb-check:[...] 0.5
//@ lldb-command:v y
//@ lldb-check:[...] 10
//@ lldb-command:continue
//@ lldb-command:v *x
//@ lldb-check:[...] 29
//@ lldb-command:v *y
//@ lldb-check:[...] 110
//@ lldb-command:continue
fn some_generic_fun<T1, T2>(a: T1, b: T2) -> (T2, T1) {
let closure = |x, y| {
zzz(); // #break
(y, x)
};
closure(a, b)
}
fn main() {
some_generic_fun(0.5f64, 10);
some_generic_fun(&29, Box::new(110));
}
fn zzz() { () }