2019-08-24 22:01:46 -05:00
|
|
|
// This test makes sure that the LLDB pretty printer does not throw an exception
|
2023-10-19 16:46:28 -05:00
|
|
|
// for nested closures and coroutines.
|
2019-08-24 22:01:46 -05:00
|
|
|
|
2024-04-22 20:55:29 -05:00
|
|
|
//@ min-lldb-version: 1800
|
2019-08-24 22:01:46 -05:00
|
|
|
//@ compile-flags:-g
|
|
|
|
|
|
|
|
// === GDB TESTS ===================================================================================
|
|
|
|
|
|
|
|
// gdb-command:run
|
|
|
|
|
|
|
|
// gdb-command:print g
|
2022-01-19 10:56:53 -06:00
|
|
|
// gdb-check:$1 = issue_57822::main::{closure_env#1} {f: issue_57822::main::{closure_env#0} {x: 1}}
|
2019-08-24 22:01:46 -05:00
|
|
|
|
|
|
|
// gdb-command:print b
|
2023-10-19 16:46:28 -05:00
|
|
|
// gdb-check:$2 = issue_57822::main::{coroutine_env#3}::Unresumed{a: issue_57822::main::{coroutine_env#2}::Unresumed{y: 2}}
|
2019-08-24 22:01:46 -05:00
|
|
|
|
|
|
|
// === LLDB TESTS ==================================================================================
|
|
|
|
|
|
|
|
// lldb-command:run
|
|
|
|
|
2024-03-15 09:05:57 -05:00
|
|
|
// lldb-command:v g
|
2024-08-18 16:00:33 -05:00
|
|
|
// lldb-check:(issue_57822::main::{closure_env#1}) g = { f = { x = 1 } }
|
2019-08-24 22:01:46 -05:00
|
|
|
|
2024-03-15 09:05:57 -05:00
|
|
|
// lldb-command:v b
|
2024-08-18 16:00:33 -05:00
|
|
|
// lldb-check:(issue_57822::main::{coroutine_env#3}) b = { value = { a = { value = { y = 2 } $discr$ = '\x02' } } $discr$ = '\x02' }
|
2019-08-24 22:01:46 -05:00
|
|
|
|
2024-04-11 08:15:34 -05:00
|
|
|
#![feature(omit_gdb_pretty_printer_section, coroutines, coroutine_trait, stmt_expr_attributes)]
|
2019-08-24 22:01:46 -05:00
|
|
|
#![omit_gdb_pretty_printer_section]
|
|
|
|
|
2023-10-19 11:06:43 -05:00
|
|
|
use std::ops::Coroutine;
|
2019-08-24 22:01:46 -05:00
|
|
|
use std::pin::Pin;
|
|
|
|
|
|
|
|
fn main() {
|
|
|
|
let mut x = 1;
|
|
|
|
let f = move || x;
|
|
|
|
let g = move || f();
|
|
|
|
|
|
|
|
let mut y = 2;
|
2024-04-11 08:15:34 -05:00
|
|
|
let mut a = #[coroutine]
|
|
|
|
move || {
|
2019-08-24 22:01:46 -05:00
|
|
|
y += 1;
|
|
|
|
yield;
|
|
|
|
};
|
2024-04-11 08:15:34 -05:00
|
|
|
let mut b = #[coroutine]
|
|
|
|
move || {
|
2020-01-25 13:03:10 -06:00
|
|
|
Pin::new(&mut a).resume(());
|
2019-08-24 22:01:46 -05:00
|
|
|
yield;
|
|
|
|
};
|
|
|
|
|
|
|
|
zzz(); // #break
|
|
|
|
}
|
|
|
|
|
2022-01-19 10:56:53 -06:00
|
|
|
fn zzz() {
|
|
|
|
()
|
|
|
|
}
|