]> git.lizzy.rs Git - rust.git/blob - src/test/debuginfo/issue-57822.rs
Rollup merge of #68415 - matthiaskrgr:tidy_clippy, r=oli-obk
[rust.git] / src / test / debuginfo / issue-57822.rs
1 // This test makes sure that the LLDB pretty printer does not throw an exception
2 // for nested closures and generators.
3
4 // Require LLVM with DW_TAG_variant_part and a gdb that can read it.
5 // min-system-llvm-version: 8.0
6 // min-gdb-version: 8.2
7 // ignore-tidy-linelength
8
9 // compile-flags:-g
10
11 // === GDB TESTS ===================================================================================
12
13 // gdb-command:run
14
15 // gdb-command:print g
16 // gdb-check:$1 = issue_57822::main::closure-1 (issue_57822::main::closure-0 (1))
17
18 // gdb-command:print b
19 // gdb-check:$2 = issue_57822::main::generator-3 {__0: issue_57822::main::generator-2 {__0: 2, <<variant>>: {[...]}}, <<variant>>: {[...]}}
20
21 // === LLDB TESTS ==================================================================================
22
23 // lldb-command:run
24
25 // lldb-command:print g
26 // lldbg-check:(issue_57822::main::closure-1) $0 = closure-1(closure-0(1))
27
28 // lldb-command:print b
29 // lldbg-check:(issue_57822::main::generator-3) $1 = generator-3(generator-2(2))
30
31 #![feature(omit_gdb_pretty_printer_section, generators, generator_trait)]
32 #![omit_gdb_pretty_printer_section]
33
34 use std::ops::Generator;
35 use std::pin::Pin;
36
37 fn main() {
38     let mut x = 1;
39     let f = move || x;
40     let g = move || f();
41
42     let mut y = 2;
43     let mut a = move || {
44         y += 1;
45         yield;
46     };
47     let mut b = move || {
48         Pin::new(&mut a).resume();
49         yield;
50     };
51
52     zzz(); // #break
53 }
54
55 fn zzz() { () }