2014-02-07 11:57:09 +08:00
|
|
|
//@ compile-flags:-g
|
2014-07-09 20:46:09 +08:00
|
|
|
|
|
|
|
// === GDB TESTS ===================================================================================
|
|
|
|
|
2014-04-24 17:35:48 +08:00
|
|
|
// gdb-command:run
|
|
|
|
|
|
|
|
// gdb-command:print constant
|
|
|
|
// gdb-check:$1 = 1
|
|
|
|
// gdb-command:print a_struct
|
2024-08-18 05:31:49 +08:00
|
|
|
// gdb-check:$2 = var_captured_in_sendable_closure::Struct {a: -2, b: 3.5, c: 4}
|
2014-04-24 17:35:48 +08:00
|
|
|
// gdb-command:print *owned
|
|
|
|
// gdb-check:$3 = 5
|
2014-11-27 22:52:16 +08:00
|
|
|
// gdb-command:continue
|
2013-08-24 00:45:02 +08:00
|
|
|
|
2014-11-27 22:52:16 +08:00
|
|
|
// gdb-command:print constant2
|
|
|
|
// gdb-check:$4 = 6
|
|
|
|
// gdb-command:continue
|
2014-07-09 20:46:09 +08:00
|
|
|
|
|
|
|
// === LLDB TESTS ==================================================================================
|
|
|
|
|
|
|
|
// lldb-command:run
|
|
|
|
|
2024-03-15 22:05:57 +08:00
|
|
|
// lldb-command:v constant
|
2024-08-19 05:00:33 +08:00
|
|
|
// lldb-check:[...] 1
|
2024-03-15 22:05:57 +08:00
|
|
|
// lldb-command:v a_struct
|
2024-08-19 05:00:33 +08:00
|
|
|
// lldb-check:[...] { a = -2 b = 3.5 c = 4 }
|
2024-03-15 22:05:57 +08:00
|
|
|
// lldb-command:v *owned
|
2024-08-19 05:00:33 +08:00
|
|
|
// lldb-check:[...] 5
|
2014-07-09 20:46:09 +08:00
|
|
|
|
2014-10-28 06:37:07 +08:00
|
|
|
#![allow(unused_variables)]
|
2015-09-20 04:33:47 +08:00
|
|
|
#![feature(omit_gdb_pretty_printer_section)]
|
2014-12-04 06:48:18 +08:00
|
|
|
#![omit_gdb_pretty_printer_section]
|
2013-08-24 00:45:02 +08:00
|
|
|
|
|
|
|
struct Struct {
|
2015-03-26 08:06:52 +08:00
|
|
|
a: isize,
|
2013-09-26 14:26:09 +08:00
|
|
|
b: f64,
|
2015-03-26 08:06:52 +08:00
|
|
|
c: usize
|
2013-08-24 00:45:02 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
fn main() {
|
|
|
|
let constant = 1;
|
|
|
|
|
|
|
|
let a_struct = Struct {
|
|
|
|
a: -2,
|
|
|
|
b: 3.5,
|
|
|
|
c: 4
|
|
|
|
};
|
|
|
|
|
2021-08-25 08:39:40 +08:00
|
|
|
let owned: Box<_> = Box::new(5);
|
2013-08-24 00:45:02 +08:00
|
|
|
|
2016-04-17 02:51:26 +08:00
|
|
|
let closure = move || {
|
2014-07-09 20:46:09 +08:00
|
|
|
zzz(); // #break
|
2014-07-08 07:35:15 +08:00
|
|
|
do_something(&constant, &a_struct.a, &*owned);
|
2013-08-24 00:45:02 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
closure();
|
2014-11-27 22:52:16 +08:00
|
|
|
|
2015-02-18 22:05:34 +08:00
|
|
|
let constant2 = 6_usize;
|
2014-11-27 22:52:16 +08:00
|
|
|
|
|
|
|
// The `self` argument of the following closure should be passed by value
|
2018-05-08 21:10:16 +08:00
|
|
|
// to FnOnce::call_once(self, args), which gets codegened a bit differently
|
2014-11-27 22:52:16 +08:00
|
|
|
// than the regular case. Let's make sure this is supported too.
|
2016-04-17 02:51:26 +08:00
|
|
|
let immedate_env = move || {
|
2014-11-27 22:52:16 +08:00
|
|
|
zzz(); // #break
|
|
|
|
return constant2;
|
|
|
|
};
|
|
|
|
|
|
|
|
immedate_env();
|
2013-08-24 00:45:02 +08:00
|
|
|
}
|
|
|
|
|
2015-03-26 08:06:52 +08:00
|
|
|
fn do_something(_: &isize, _:&isize, _:&isize) {
|
2013-08-24 00:45:02 +08:00
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
fn zzz() {()}
|