1 // This test case tests the incremental compilation hash (ICH) implementation
2 // for `while let` loops.
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.
8 // build-pass (FIXME(62277): could be check-pass?)
9 // revisions: cfail1 cfail2 cfail3 cfail4 cfail5 cfail6
10 // compile-flags: -Z query-dep-graph -O
11 // [cfail1]compile-flags: -Zincremental-ignore-spans
12 // [cfail2]compile-flags: -Zincremental-ignore-spans
13 // [cfail3]compile-flags: -Zincremental-ignore-spans
14 // [cfail4]compile-flags: -Zincremental-relative-spans
15 // [cfail5]compile-flags: -Zincremental-relative-spans
16 // [cfail6]compile-flags: -Zincremental-relative-spans
19 #![feature(rustc_attrs)]
24 #[cfg(any(cfail1,cfail4))]
25 pub fn change_loop_body() {
27 while let Some(0u32) = None {
33 #[cfg(not(any(cfail1,cfail4)))]
34 #[rustc_clean(cfg="cfail2", except="hir_owner_nodes")]
35 #[rustc_clean(cfg="cfail3")]
36 #[rustc_clean(cfg="cfail5", except="hir_owner_nodes")]
37 #[rustc_clean(cfg="cfail6")]
38 pub fn change_loop_body() {
40 while let Some(0u32) = None {
49 #[cfg(any(cfail1,cfail4))]
50 pub fn change_loop_condition() {
52 while let Some(0u32) = None {
58 #[cfg(not(any(cfail1,cfail4)))]
59 #[rustc_clean(cfg="cfail2", except="hir_owner_nodes")]
60 #[rustc_clean(cfg="cfail3")]
61 #[rustc_clean(cfg="cfail5", except="hir_owner_nodes")]
62 #[rustc_clean(cfg="cfail6")]
63 pub fn change_loop_condition() {
65 while let Some(1u32) = None {
74 #[cfg(any(cfail1,cfail4))]
77 while let Some(0u32) = None {
83 #[cfg(not(any(cfail1,cfail4)))]
84 #[rustc_clean(cfg="cfail2", except="hir_owner_nodes, typeck")]
85 #[rustc_clean(cfg="cfail3")]
86 #[rustc_clean(cfg="cfail5", except="hir_owner_nodes, typeck")]
87 #[rustc_clean(cfg="cfail6")]
90 while let Some(0u32) = None {
99 #[cfg(any(cfail1,cfail4))]
100 pub fn add_loop_label() {
102 while let Some(0u32) = None {
108 #[cfg(not(any(cfail1,cfail4)))]
109 #[rustc_clean(cfg="cfail2", except="hir_owner_nodes")]
110 #[rustc_clean(cfg="cfail3")]
111 #[rustc_clean(cfg="cfail5", except="hir_owner_nodes")]
112 #[rustc_clean(cfg="cfail6")]
113 pub fn add_loop_label() {
115 'label: while let Some(0u32) = None {
123 // Add loop label to break
124 #[cfg(any(cfail1,cfail4))]
125 pub fn add_loop_label_to_break() {
127 'label: while let Some(0u32) = None {
133 #[cfg(not(any(cfail1,cfail4)))]
134 #[rustc_clean(cfg="cfail2", except="hir_owner_nodes")]
135 #[rustc_clean(cfg="cfail3")]
136 #[rustc_clean(cfg="cfail5", except="hir_owner_nodes")]
137 #[rustc_clean(cfg="cfail6")]
138 pub fn add_loop_label_to_break() {
140 'label: while let Some(0u32) = None {
148 // Change break label
149 #[cfg(any(cfail1,cfail4))]
150 pub fn change_break_label() {
152 'outer: while let Some(0u32) = None {
153 'inner: while let Some(0u32) = None {
160 #[cfg(not(any(cfail1,cfail4)))]
161 #[rustc_clean(cfg="cfail2", except="hir_owner_nodes")]
162 #[rustc_clean(cfg="cfail3")]
163 #[rustc_clean(cfg="cfail5", except="hir_owner_nodes")]
164 #[rustc_clean(cfg="cfail6")]
165 pub fn change_break_label() {
167 'outer: while let Some(0u32) = None {
168 'inner: while let Some(0u32) = None {
175 // Add loop label to continue
176 #[cfg(any(cfail1,cfail4))]
177 pub fn add_loop_label_to_continue() {
179 'label: while let Some(0u32) = None {
185 #[cfg(not(any(cfail1,cfail4)))]
186 #[rustc_clean(cfg="cfail2", except="hir_owner_nodes")]
187 #[rustc_clean(cfg="cfail3")]
188 #[rustc_clean(cfg="cfail5", except="hir_owner_nodes")]
189 #[rustc_clean(cfg="cfail6")]
190 pub fn add_loop_label_to_continue() {
192 'label: while let Some(0u32) = None {
200 // Change continue label
201 #[cfg(any(cfail1,cfail4))]
202 pub fn change_continue_label() {
204 'outer: while let Some(0u32) = None {
205 'inner: while let Some(0u32) = None {
212 #[cfg(not(any(cfail1,cfail4)))]
213 #[rustc_clean(cfg="cfail2", except="hir_owner_nodes")]
214 #[rustc_clean(cfg="cfail3")]
215 #[rustc_clean(cfg="cfail5", except="hir_owner_nodes")]
216 #[rustc_clean(cfg="cfail6")]
217 pub fn change_continue_label() {
219 'outer: while let Some(0u32) = None {
220 'inner: while let Some(0u32) = None {
229 // Change continue to break
230 #[cfg(any(cfail1,cfail4))]
231 pub fn change_continue_to_break() {
233 while let Some(0u32) = None {
239 #[cfg(not(any(cfail1,cfail4)))]
240 #[rustc_clean(cfg="cfail2", except="hir_owner_nodes")]
241 #[rustc_clean(cfg="cfail3")]
242 #[rustc_clean(cfg="cfail5", except="hir_owner_nodes")]
243 #[rustc_clean(cfg="cfail6")]
244 pub fn change_continue_to_break() {
246 while let Some(0u32) = None {