]> git.lizzy.rs Git - rust.git/blob - src/test/debuginfo/closure-in-generic-function.rs
Auto merge of #28816 - petrochenkov:unistruct, r=nrc
[rust.git] / src / test / debuginfo / closure-in-generic-function.rs
1 // Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT
2 // file at the top-level directory of this distribution and at
3 // http://rust-lang.org/COPYRIGHT.
4 //
5 // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6 // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7 // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8 // option. This file may not be copied, modified, or distributed
9 // except according to those terms.
10
11 // min-lldb-version: 310
12
13 // compile-flags:-g
14
15 // === GDB TESTS ===================================================================================
16
17 // gdb-command:run
18
19 // gdb-command:print x
20 // gdb-check:$1 = 0.5
21 // gdb-command:print y
22 // gdb-check:$2 = 10
23 // gdb-command:continue
24
25 // gdb-command:print *x
26 // gdb-check:$3 = 29
27 // gdb-command:print *y
28 // gdb-check:$4 = 110
29 // gdb-command:continue
30
31
32 // === LLDB TESTS ==================================================================================
33
34 // lldb-command:run
35
36 // lldb-command:print x
37 // lldb-check:[...]$0 = 0.5
38 // lldb-command:print y
39 // lldb-check:[...]$1 = 10
40 // lldb-command:continue
41
42 // lldb-command:print *x
43 // lldb-check:[...]$2 = 29
44 // lldb-command:print *y
45 // lldb-check:[...]$3 = 110
46 // lldb-command:continue
47
48 #![feature(box_syntax)]
49 #![feature(omit_gdb_pretty_printer_section)]
50 #![omit_gdb_pretty_printer_section]
51
52 fn some_generic_fun<T1, T2>(a: T1, b: T2) -> (T2, T1) {
53
54     let closure = |x, y| {
55         zzz(); // #break
56         (y, x)
57     };
58
59     closure(a, b)
60 }
61
62 fn main() {
63     some_generic_fun(0.5f64, 10);
64     some_generic_fun(&29, Box::new(110));
65 }
66
67 fn zzz() { () }