]>
Commit | Line | Data |
---|---|---|
476ff2be SL |
1 | // This test case tests the incremental compilation hash (ICH) implementation |
2 | // for `while` loops. | |
3 | ||
4 | // The general pattern followed here is: Change one thing between rev1 and rev2 | |
5 | // and make sure that the hash has changed, then change nothing between rev2 and | |
6 | // rev3 and make sure that the hash has not changed. | |
7 | ||
416331ca | 8 | // build-pass (FIXME(62277): could be check-pass?) |
476ff2be | 9 | // revisions: cfail1 cfail2 cfail3 |
ff7c6d11 | 10 | // compile-flags: -Z query-dep-graph -Zincremental-ignore-spans |
476ff2be SL |
11 | |
12 | #![allow(warnings)] | |
13 | #![feature(rustc_attrs)] | |
14 | #![crate_type="rlib"] | |
15 | ||
16 | ||
e1599b0c | 17 | // Change loop body |
476ff2be | 18 | #[cfg(cfail1)] |
ff7c6d11 | 19 | pub fn change_loop_body() { |
476ff2be SL |
20 | let mut _x = 0; |
21 | while true { | |
22 | _x = 1; | |
23 | break; | |
24 | } | |
25 | } | |
26 | ||
27 | #[cfg(not(cfail1))] | |
ba9703b0 | 28 | #[rustc_clean(cfg="cfail2", except="hir_owner_nodes, mir_built, optimized_mir")] |
ff7c6d11 XL |
29 | #[rustc_clean(cfg="cfail3")] |
30 | pub fn change_loop_body() { | |
476ff2be SL |
31 | let mut _x = 0; |
32 | while true { | |
33 | _x = 2; | |
34 | break; | |
35 | } | |
36 | } | |
37 | ||
38 | ||
39 | ||
e1599b0c | 40 | // Change loop body |
476ff2be | 41 | #[cfg(cfail1)] |
ff7c6d11 | 42 | pub fn change_loop_condition() { |
476ff2be SL |
43 | let mut _x = 0; |
44 | while true { | |
45 | _x = 1; | |
46 | break; | |
47 | } | |
48 | } | |
49 | ||
50 | #[cfg(not(cfail1))] | |
ba9703b0 | 51 | #[rustc_clean(cfg="cfail2", except="hir_owner_nodes, mir_built, optimized_mir")] |
ff7c6d11 XL |
52 | #[rustc_clean(cfg="cfail3")] |
53 | pub fn change_loop_condition() { | |
476ff2be SL |
54 | let mut _x = 0; |
55 | while false { | |
56 | _x = 1; | |
57 | break; | |
58 | } | |
59 | } | |
60 | ||
61 | ||
62 | ||
e1599b0c | 63 | // Add break |
476ff2be | 64 | #[cfg(cfail1)] |
ff7c6d11 | 65 | pub fn add_break() { |
476ff2be SL |
66 | let mut _x = 0; |
67 | while true { | |
68 | _x = 1; | |
69 | } | |
70 | } | |
71 | ||
72 | #[cfg(not(cfail1))] | |
ba9703b0 | 73 | #[rustc_clean(cfg="cfail2", except="hir_owner_nodes, mir_built, optimized_mir, typeck_tables_of")] |
ff7c6d11 XL |
74 | #[rustc_clean(cfg="cfail3")] |
75 | pub fn add_break() { | |
476ff2be SL |
76 | let mut _x = 0; |
77 | while true { | |
78 | _x = 1; | |
79 | break; | |
80 | } | |
81 | } | |
82 | ||
83 | ||
84 | ||
e1599b0c | 85 | // Add loop label |
476ff2be | 86 | #[cfg(cfail1)] |
ff7c6d11 | 87 | pub fn add_loop_label() { |
476ff2be SL |
88 | let mut _x = 0; |
89 | while true { | |
90 | _x = 1; | |
91 | break; | |
92 | } | |
93 | } | |
94 | ||
95 | #[cfg(not(cfail1))] | |
ba9703b0 | 96 | #[rustc_clean(cfg="cfail2", except="hir_owner_nodes")] |
ff7c6d11 XL |
97 | #[rustc_clean(cfg="cfail3")] |
98 | pub fn add_loop_label() { | |
476ff2be SL |
99 | let mut _x = 0; |
100 | 'label: while true { | |
101 | _x = 1; | |
102 | break; | |
103 | } | |
104 | } | |
105 | ||
106 | ||
107 | ||
e1599b0c | 108 | // Add loop label to break |
476ff2be | 109 | #[cfg(cfail1)] |
ff7c6d11 | 110 | pub fn add_loop_label_to_break() { |
476ff2be SL |
111 | let mut _x = 0; |
112 | 'label: while true { | |
113 | _x = 1; | |
114 | break; | |
115 | } | |
116 | } | |
117 | ||
118 | #[cfg(not(cfail1))] | |
ba9703b0 | 119 | #[rustc_clean(cfg="cfail2", except="hir_owner_nodes")] |
ff7c6d11 XL |
120 | #[rustc_clean(cfg="cfail3")] |
121 | pub fn add_loop_label_to_break() { | |
476ff2be SL |
122 | let mut _x = 0; |
123 | 'label: while true { | |
124 | _x = 1; | |
125 | break 'label; | |
126 | } | |
127 | } | |
128 | ||
129 | ||
130 | ||
e1599b0c | 131 | // Change break label |
476ff2be | 132 | #[cfg(cfail1)] |
ff7c6d11 | 133 | pub fn change_break_label() { |
476ff2be SL |
134 | let mut _x = 0; |
135 | 'outer: while true { | |
136 | 'inner: while true { | |
137 | _x = 1; | |
138 | break 'inner; | |
139 | } | |
140 | } | |
141 | } | |
142 | ||
143 | #[cfg(not(cfail1))] | |
ba9703b0 | 144 | #[rustc_clean(cfg="cfail2", except="hir_owner_nodes, mir_built, optimized_mir")] |
ff7c6d11 XL |
145 | #[rustc_clean(cfg="cfail3")] |
146 | pub fn change_break_label() { | |
476ff2be SL |
147 | let mut _x = 0; |
148 | 'outer: while true { | |
149 | 'inner: while true { | |
150 | _x = 1; | |
151 | break 'outer; | |
152 | } | |
153 | } | |
154 | } | |
155 | ||
156 | ||
157 | ||
e1599b0c | 158 | // Add loop label to continue |
476ff2be | 159 | #[cfg(cfail1)] |
ff7c6d11 | 160 | pub fn add_loop_label_to_continue() { |
476ff2be SL |
161 | let mut _x = 0; |
162 | 'label: while true { | |
163 | _x = 1; | |
164 | continue; | |
165 | } | |
166 | } | |
167 | ||
168 | #[cfg(not(cfail1))] | |
ba9703b0 | 169 | #[rustc_clean(cfg="cfail2", except="hir_owner_nodes")] |
ff7c6d11 XL |
170 | #[rustc_clean(cfg="cfail3")] |
171 | pub fn add_loop_label_to_continue() { | |
476ff2be SL |
172 | let mut _x = 0; |
173 | 'label: while true { | |
174 | _x = 1; | |
175 | continue 'label; | |
176 | } | |
177 | } | |
178 | ||
179 | ||
180 | ||
e1599b0c | 181 | // Change continue label |
476ff2be | 182 | #[cfg(cfail1)] |
ff7c6d11 | 183 | pub fn change_continue_label() { |
476ff2be SL |
184 | let mut _x = 0; |
185 | 'outer: while true { | |
186 | 'inner: while true { | |
187 | _x = 1; | |
188 | continue 'inner; | |
189 | } | |
190 | } | |
191 | } | |
192 | ||
193 | #[cfg(not(cfail1))] | |
ba9703b0 | 194 | #[rustc_clean(cfg="cfail2", except="hir_owner_nodes, mir_built")] |
ff7c6d11 XL |
195 | #[rustc_clean(cfg="cfail3")] |
196 | pub fn change_continue_label() { | |
476ff2be SL |
197 | let mut _x = 0; |
198 | 'outer: while true { | |
199 | 'inner: while true { | |
200 | _x = 1; | |
201 | continue 'outer; | |
202 | } | |
203 | } | |
204 | } | |
205 | ||
206 | ||
207 | ||
e1599b0c | 208 | // Change continue to break |
476ff2be | 209 | #[cfg(cfail1)] |
ff7c6d11 | 210 | pub fn change_continue_to_break() { |
476ff2be SL |
211 | let mut _x = 0; |
212 | while true { | |
213 | _x = 1; | |
214 | continue; | |
215 | } | |
216 | } | |
217 | ||
218 | #[cfg(not(cfail1))] | |
ba9703b0 | 219 | #[rustc_clean(cfg="cfail2", except="hir_owner_nodes, mir_built, optimized_mir")] |
ff7c6d11 XL |
220 | #[rustc_clean(cfg="cfail3")] |
221 | pub fn change_continue_to_break() { | |
476ff2be SL |
222 | let mut _x = 0; |
223 | while true { | |
224 | _x = 1; | |
225 | break; | |
226 | } | |
227 | } |