]> git.lizzy.rs Git - rust.git/blob - tests/debuginfo/issue-57822.rs
Merge commit '7d53619064ab7045c383644cb445052d2a3d46db' into sync_cg_clif-2023-02-09
[rust.git] / tests / 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 a gdb that can read DW_TAG_variant_part.
5 // min-gdb-version: 8.2
6
7 // compile-flags:-g
8
9 // === GDB TESTS ===================================================================================
10
11 // gdb-command:run
12
13 // gdb-command:print g
14 // gdb-check:$1 = issue_57822::main::{closure_env#1} {f: issue_57822::main::{closure_env#0} {x: 1}}
15
16 // gdb-command:print b
17 // gdb-check:$2 = issue_57822::main::{generator_env#3}::Unresumed{a: issue_57822::main::{generator_env#2}::Unresumed{y: 2}}
18
19 // === LLDB TESTS ==================================================================================
20
21 // lldb-command:run
22
23 // lldb-command:print g
24 // lldbg-check:(issue_57822::main::{closure_env#1}) $0 = { f = { x = 1 } }
25
26 // lldb-command:print b
27 // lldbg-check:(issue_57822::main::{generator_env#3}) $1 =
28
29 #![feature(omit_gdb_pretty_printer_section, generators, generator_trait)]
30 #![omit_gdb_pretty_printer_section]
31
32 use std::ops::Generator;
33 use std::pin::Pin;
34
35 fn main() {
36     let mut x = 1;
37     let f = move || x;
38     let g = move || f();
39
40     let mut y = 2;
41     let mut a = move || {
42         y += 1;
43         yield;
44     };
45     let mut b = move || {
46         Pin::new(&mut a).resume(());
47         yield;
48     };
49
50     zzz(); // #break
51 }
52
53 fn zzz() {
54     ()
55 }