]> git.lizzy.rs Git - rust.git/blob - src/test/debuginfo/var-captured-in-nested-closure.rs
Do not use entropy during gen_weighted_bool(1)
[rust.git] / src / test / debuginfo / var-captured-in-nested-closure.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 // ignore-android: FIXME(#10381)
12 // min-lldb-version: 310
13
14 // compile-flags:-g
15
16 // === GDB TESTS ===================================================================================
17
18 // gdb-command:run
19
20 // gdb-command:print variable
21 // gdb-check:$1 = 1
22 // gdb-command:print constant
23 // gdb-check:$2 = 2
24 // gdb-command:print a_struct
25 // gdb-check:$3 = {a = -3, b = 4.5, c = 5}
26 // gdb-command:print *struct_ref
27 // gdb-check:$4 = {a = -3, b = 4.5, c = 5}
28 // gdb-command:print *owned
29 // gdb-check:$5 = 6
30 // gdb-command:print closure_local
31 // gdb-check:$6 = 8
32 // gdb-command:continue
33
34 // gdb-command:print variable
35 // gdb-check:$7 = 1
36 // gdb-command:print constant
37 // gdb-check:$8 = 2
38 // gdb-command:print a_struct
39 // gdb-check:$9 = {a = -3, b = 4.5, c = 5}
40 // gdb-command:print *struct_ref
41 // gdb-check:$10 = {a = -3, b = 4.5, c = 5}
42 // gdb-command:print *owned
43 // gdb-check:$11 = 6
44 // gdb-command:print closure_local
45 // gdb-check:$12 = 8
46 // gdb-command:continue
47
48
49 // === LLDB TESTS ==================================================================================
50
51 // lldb-command:run
52
53 // lldb-command:print variable
54 // lldb-check:[...]$0 = 1
55 // lldb-command:print constant
56 // lldb-check:[...]$1 = 2
57 // lldb-command:print a_struct
58 // lldb-check:[...]$2 = Struct { a: -3, b: 4.5, c: 5 }
59 // lldb-command:print *struct_ref
60 // lldb-check:[...]$3 = Struct { a: -3, b: 4.5, c: 5 }
61 // lldb-command:print *owned
62 // lldb-check:[...]$4 = 6
63 // lldb-command:print closure_local
64 // lldb-check:[...]$5 = 8
65 // lldb-command:continue
66
67 // lldb-command:print variable
68 // lldb-check:[...]$6 = 1
69 // lldb-command:print constant
70 // lldb-check:[...]$7 = 2
71 // lldb-command:print a_struct
72 // lldb-check:[...]$8 = Struct { a: -3, b: 4.5, c: 5 }
73 // lldb-command:print *struct_ref
74 // lldb-check:[...]$9 = Struct { a: -3, b: 4.5, c: 5 }
75 // lldb-command:print *owned
76 // lldb-check:[...]$10 = 6
77 // lldb-command:print closure_local
78 // lldb-check:[...]$11 = 8
79 // lldb-command:continue
80
81 #![allow(unused_variables)]
82 #![omit_gdb_pretty_printer_section]
83
84 struct Struct {
85     a: int,
86     b: f64,
87     c: uint
88 }
89
90 fn main() {
91     let mut variable = 1;
92     let constant = 2;
93
94     let a_struct = Struct {
95         a: -3,
96         b: 4.5,
97         c: 5
98     };
99
100     let struct_ref = &a_struct;
101     let owned = box 6;
102
103     let closure = || {
104         let closure_local = 8;
105
106         let nested_closure = || {
107             zzz(); // #break
108             variable = constant + a_struct.a + struct_ref.a + *owned + closure_local;
109         };
110
111         zzz(); // #break
112
113         nested_closure();
114     };
115
116     closure();
117 }
118
119 fn zzz() {()}