]> git.lizzy.rs Git - rust.git/blob - tests/debuginfo/lexical-scope-in-for-loop.rs
Rollup merge of #107700 - jyn514:tools-builder, r=Mark-Simulacrum
[rust.git] / tests / debuginfo / lexical-scope-in-for-loop.rs
1 // min-lldb-version: 310
2
3 // compile-flags:-g
4
5 // === GDB TESTS ===================================================================================
6
7 // gdb-command:run
8
9 // FIRST ITERATION
10 // gdb-command:print x
11 // gdb-check:$1 = 1
12 // gdb-command:continue
13
14 // gdb-command:print x
15 // gdb-check:$2 = -1
16 // gdb-command:continue
17
18 // SECOND ITERATION
19 // gdb-command:print x
20 // gdb-check:$3 = 2
21 // gdb-command:continue
22
23 // gdb-command:print x
24 // gdb-check:$4 = -2
25 // gdb-command:continue
26
27 // THIRD ITERATION
28 // gdb-command:print x
29 // gdb-check:$5 = 3
30 // gdb-command:continue
31
32 // gdb-command:print x
33 // gdb-check:$6 = -3
34 // gdb-command:continue
35
36 // AFTER LOOP
37 // gdb-command:print x
38 // gdb-check:$7 = 1000000
39 // gdb-command:continue
40
41
42 // === LLDB TESTS ==================================================================================
43
44 // lldb-command:run
45
46 // FIRST ITERATION
47 // lldb-command:print x
48 // lldbg-check:[...]$0 = 1
49 // lldbr-check:(i32) x = 1
50 // lldb-command:continue
51
52 // lldb-command:print x
53 // lldbg-check:[...]$1 = -1
54 // lldbr-check:(i32) x = -1
55 // lldb-command:continue
56
57 // SECOND ITERATION
58 // lldb-command:print x
59 // lldbg-check:[...]$2 = 2
60 // lldbr-check:(i32) x = 2
61 // lldb-command:continue
62
63 // lldb-command:print x
64 // lldbg-check:[...]$3 = -2
65 // lldbr-check:(i32) x = -2
66 // lldb-command:continue
67
68 // THIRD ITERATION
69 // lldb-command:print x
70 // lldbg-check:[...]$4 = 3
71 // lldbr-check:(i32) x = 3
72 // lldb-command:continue
73
74 // lldb-command:print x
75 // lldbg-check:[...]$5 = -3
76 // lldbr-check:(i32) x = -3
77 // lldb-command:continue
78
79 // AFTER LOOP
80 // lldb-command:print x
81 // lldbg-check:[...]$6 = 1000000
82 // lldbr-check:(i32) x = 1000000
83 // lldb-command:continue
84
85 #![feature(omit_gdb_pretty_printer_section)]
86 #![omit_gdb_pretty_printer_section]
87
88 fn main() {
89
90     let range = [1, 2, 3];
91
92     let x = 1000000; // wan meeeljen doollaars!
93
94     for &x in &range {
95         zzz(); // #break
96         sentinel();
97
98         let x = -1 * x;
99
100         zzz(); // #break
101         sentinel();
102     }
103
104     zzz(); // #break
105     sentinel();
106 }
107
108 fn zzz() {()}
109 fn sentinel() {()}