]> git.proxmox.com Git - rustc.git/blame - src/test/debuginfo/issue-57822.rs
New upstream version 1.55.0+dfsg1
[rustc.git] / src / test / debuginfo / issue-57822.rs
CommitLineData
416331ca
XL
1// This test makes sure that the LLDB pretty printer does not throw an exception
2// for nested closures and generators.
3
ba9703b0 4// Require a gdb that can read DW_TAG_variant_part.
416331ca 5// min-gdb-version: 8.2
416331ca
XL
6
7// compile-flags:-g
8
9// === GDB TESTS ===================================================================================
10
11// gdb-command:run
12
13// gdb-command:print g
136023e0 14// gdb-check:$1 = issue_57822::main::{closure#1} (issue_57822::main::{closure#0} (1))
416331ca
XL
15
16// gdb-command:print b
136023e0 17// gdb-check:$2 = issue_57822::main::{generator#3}::Unresumed(issue_57822::main::{generator#2}::Unresumed(2))
416331ca
XL
18
19// === LLDB TESTS ==================================================================================
20
21// lldb-command:run
22
23// lldb-command:print g
136023e0 24// lldbg-check:(issue_57822::main::{closure#1}) $0 = { 0 = { 0 = 1 } }
416331ca
XL
25
26// lldb-command:print b
136023e0 27// lldbg-check:(issue_57822::main::{generator#3}) $1 =
416331ca
XL
28
29#![feature(omit_gdb_pretty_printer_section, generators, generator_trait)]
30#![omit_gdb_pretty_printer_section]
31
32use std::ops::Generator;
33use std::pin::Pin;
34
35fn 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 || {
74b04a01 46 Pin::new(&mut a).resume(());
416331ca
XL
47 yield;
48 };
49
50 zzz(); // #break
51}
52
53fn zzz() { () }