]> git.lizzy.rs Git - rust.git/blob - src/test/debuginfo/lexical-scope-in-if.rs
Auto merge of #28816 - petrochenkov:unistruct, r=nrc
[rust.git] / src / test / debuginfo / lexical-scope-in-if.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 // BEFORE if
20 // gdb-command:print x
21 // gdb-check:$1 = 999
22 // gdb-command:print y
23 // gdb-check:$2 = -1
24 // gdb-command:continue
25
26 // AT BEGINNING of 'then' block
27 // gdb-command:print x
28 // gdb-check:$3 = 999
29 // gdb-command:print y
30 // gdb-check:$4 = -1
31 // gdb-command:continue
32
33 // AFTER 1st redeclaration of 'x'
34 // gdb-command:print x
35 // gdb-check:$5 = 1001
36 // gdb-command:print y
37 // gdb-check:$6 = -1
38 // gdb-command:continue
39
40 // AFTER 2st redeclaration of 'x'
41 // gdb-command:print x
42 // gdb-check:$7 = 1002
43 // gdb-command:print y
44 // gdb-check:$8 = 1003
45 // gdb-command:continue
46
47 // AFTER 1st if expression
48 // gdb-command:print x
49 // gdb-check:$9 = 999
50 // gdb-command:print y
51 // gdb-check:$10 = -1
52 // gdb-command:continue
53
54 // BEGINNING of else branch
55 // gdb-command:print x
56 // gdb-check:$11 = 999
57 // gdb-command:print y
58 // gdb-check:$12 = -1
59 // gdb-command:continue
60
61 // BEGINNING of else branch
62 // gdb-command:print x
63 // gdb-check:$13 = 1004
64 // gdb-command:print y
65 // gdb-check:$14 = 1005
66 // gdb-command:continue
67
68 // BEGINNING of else branch
69 // gdb-command:print x
70 // gdb-check:$15 = 999
71 // gdb-command:print y
72 // gdb-check:$16 = -1
73 // gdb-command:continue
74
75
76 // === LLDB TESTS ==================================================================================
77
78 // lldb-command:run
79
80 // BEFORE if
81 // lldb-command:print x
82 // lldb-check:[...]$0 = 999
83 // lldb-command:print y
84 // lldb-check:[...]$1 = -1
85 // lldb-command:continue
86
87 // AT BEGINNING of 'then' block
88 // lldb-command:print x
89 // lldb-check:[...]$2 = 999
90 // lldb-command:print y
91 // lldb-check:[...]$3 = -1
92 // lldb-command:continue
93
94 // AFTER 1st redeclaration of 'x'
95 // lldb-command:print x
96 // lldb-check:[...]$4 = 1001
97 // lldb-command:print y
98 // lldb-check:[...]$5 = -1
99 // lldb-command:continue
100
101 // AFTER 2st redeclaration of 'x'
102 // lldb-command:print x
103 // lldb-check:[...]$6 = 1002
104 // lldb-command:print y
105 // lldb-check:[...]$7 = 1003
106 // lldb-command:continue
107
108 // AFTER 1st if expression
109 // lldb-command:print x
110 // lldb-check:[...]$8 = 999
111 // lldb-command:print y
112 // lldb-check:[...]$9 = -1
113 // lldb-command:continue
114
115 // BEGINNING of else branch
116 // lldb-command:print x
117 // lldb-check:[...]$10 = 999
118 // lldb-command:print y
119 // lldb-check:[...]$11 = -1
120 // lldb-command:continue
121
122 // BEGINNING of else branch
123 // lldb-command:print x
124 // lldb-check:[...]$12 = 1004
125 // lldb-command:print y
126 // lldb-check:[...]$13 = 1005
127 // lldb-command:continue
128
129 // BEGINNING of else branch
130 // lldb-command:print x
131 // lldb-check:[...]$14 = 999
132 // lldb-command:print y
133 // lldb-check:[...]$15 = -1
134 // lldb-command:continue
135
136 #![feature(omit_gdb_pretty_printer_section)]
137 #![omit_gdb_pretty_printer_section]
138
139 fn main() {
140
141     let x = 999;
142     let y = -1;
143
144     zzz(); // #break
145     sentinel();
146
147     if x < 1000 {
148         zzz(); // #break
149         sentinel();
150
151         let x = 1001;
152
153         zzz(); // #break
154         sentinel();
155
156         let x = 1002;
157         let y = 1003;
158         zzz(); // #break
159         sentinel();
160     } else {
161         unreachable!();
162     }
163
164     zzz(); // #break
165     sentinel();
166
167     if x > 1000 {
168         unreachable!();
169     } else {
170         zzz(); // #break
171         sentinel();
172
173         let x = 1004;
174         let y = 1005;
175         zzz(); // #break
176         sentinel();
177     }
178
179     zzz(); // #break
180     sentinel();
181 }
182
183 fn zzz() {()}
184 fn sentinel() {()}