1 // This test case tests the incremental compilation hash (ICH) implementation
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
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)]
23 // Change loop body ------------------------------------------------------------
24 #[cfg(any(cfail1,cfail4))]
25 pub fn change_loop_body() {
33 #[cfg(not(any(cfail1,cfail4)))]
34 #[rustc_clean(cfg="cfail2", except="hir_owner_nodes, optimized_mir")]
35 #[rustc_clean(cfg="cfail3")]
36 #[rustc_clean(cfg="cfail5", except="hir_owner_nodes, optimized_mir")]
37 #[rustc_clean(cfg="cfail6")]
38 pub fn change_loop_body() {
48 // Change iteration variable name ----------------------------------------------
49 #[cfg(any(cfail1,cfail4))]
50 pub fn change_iteration_variable_name() {
58 #[cfg(not(any(cfail1,cfail4)))]
59 #[rustc_clean(cfg="cfail2", except="hir_owner_nodes, optimized_mir")]
60 #[rustc_clean(cfg="cfail3")]
61 #[rustc_clean(cfg="cfail5", except="hir_owner_nodes, optimized_mir")]
62 #[rustc_clean(cfg="cfail6")]
63 pub fn change_iteration_variable_name() {
73 // Change iteration variable pattern -------------------------------------------
74 #[cfg(any(cfail1,cfail4))]
75 pub fn change_iteration_variable_pattern() {
77 for _i in &[0, 1, 2] {
83 #[cfg(not(any(cfail1,cfail4)))]
84 #[rustc_clean(cfg="cfail2", except="hir_owner_nodes, optimized_mir, typeck")]
85 #[rustc_clean(cfg="cfail3")]
86 #[rustc_clean(cfg="cfail5", except="hir_owner_nodes, optimized_mir, typeck")]
87 #[rustc_clean(cfg="cfail6")]
88 pub fn change_iteration_variable_pattern() {
90 for &_i in &[0, 1, 2] {
98 // Change iterable -------------------------------------------------------------
99 #[cfg(any(cfail1,cfail4))]
100 pub fn change_iterable() {
102 for _ in &[0, 1, 2] {
108 #[cfg(not(any(cfail1,cfail4)))]
109 #[rustc_clean(cfg="cfail2", except="hir_owner_nodes, promoted_mir")]
110 #[rustc_clean(cfg="cfail3")]
111 #[rustc_clean(cfg="cfail5", except="hir_owner_nodes, promoted_mir")]
112 #[rustc_clean(cfg="cfail6")]
113 pub fn change_iterable() {
115 for _ in &[0, 1, 3] {
123 // Add break -------------------------------------------------------------------
124 #[cfg(any(cfail1,cfail4))]
133 #[cfg(not(any(cfail1,cfail4)))]
134 #[rustc_clean(cfg="cfail2", except="hir_owner_nodes, optimized_mir, typeck")]
135 #[rustc_clean(cfg="cfail3")]
136 #[rustc_clean(cfg="cfail5", except="hir_owner_nodes, optimized_mir, typeck")]
137 #[rustc_clean(cfg="cfail6")]
148 // Add loop label --------------------------------------------------------------
149 #[cfg(any(cfail1,cfail4))]
150 pub fn add_loop_label() {
158 #[cfg(not(any(cfail1,cfail4)))]
159 #[rustc_clean(cfg="cfail2", except="hir_owner_nodes")]
160 #[rustc_clean(cfg="cfail3")]
161 #[rustc_clean(cfg="cfail5", except="hir_owner_nodes, optimized_mir")]
162 #[rustc_clean(cfg="cfail6")]
163 pub fn add_loop_label() {
165 'label: for _ in 0..1 {
173 // Add loop label to break -----------------------------------------------------
174 #[cfg(any(cfail1,cfail4))]
175 pub fn add_loop_label_to_break() {
177 'label: for _ in 0..1 {
183 #[cfg(not(any(cfail1,cfail4)))]
184 #[rustc_clean(cfg="cfail2", except="hir_owner_nodes")]
185 #[rustc_clean(cfg="cfail3")]
186 #[rustc_clean(cfg="cfail5", except="hir_owner_nodes")]
187 #[rustc_clean(cfg="cfail6")]
188 pub fn add_loop_label_to_break() {
190 'label: for _ in 0..1 {
198 // Change break label ----------------------------------------------------------
199 #[cfg(any(cfail1,cfail4))]
200 pub fn change_break_label() {
202 'outer: for _ in 0..1 {
203 'inner: for _ in 0..1 {
210 #[cfg(not(any(cfail1,cfail4)))]
211 #[rustc_clean(cfg="cfail2", except="hir_owner_nodes, optimized_mir")]
212 #[rustc_clean(cfg="cfail3")]
213 #[rustc_clean(cfg="cfail5", except="hir_owner_nodes, optimized_mir")]
214 #[rustc_clean(cfg="cfail6")]
215 pub fn change_break_label() {
217 'outer: for _ in 0..1 {
218 'inner: for _ in 0..1 {
227 // Add loop label to continue --------------------------------------------------
228 #[cfg(any(cfail1,cfail4))]
229 pub fn add_loop_label_to_continue() {
231 'label: for _ in 0..1 {
237 #[cfg(not(any(cfail1,cfail4)))]
238 #[rustc_clean(cfg="cfail2", except="hir_owner_nodes")]
239 #[rustc_clean(cfg="cfail3")]
240 #[rustc_clean(cfg="cfail5", except="hir_owner_nodes")]
241 #[rustc_clean(cfg="cfail6")]
242 pub fn add_loop_label_to_continue() {
244 'label: for _ in 0..1 {
252 // Change continue label ----------------------------------------------------------
253 #[cfg(any(cfail1,cfail4))]
254 pub fn change_continue_label() {
256 'outer: for _ in 0..1 {
257 'inner: for _ in 0..1 {
264 #[cfg(not(any(cfail1,cfail4)))]
265 #[rustc_clean(cfg="cfail2", except="hir_owner_nodes, optimized_mir")]
266 #[rustc_clean(cfg="cfail3")]
267 #[rustc_clean(cfg="cfail5", except="hir_owner_nodes, optimized_mir")]
268 #[rustc_clean(cfg="cfail6")]
269 pub fn change_continue_label() {
271 'outer: for _ in 0..1 {
272 'inner: for _ in 0..1 {
281 // Change continue to break ----------------------------------------------------
282 #[cfg(any(cfail1,cfail4))]
283 pub fn change_continue_to_break() {
291 #[cfg(not(any(cfail1,cfail4)))]
292 #[rustc_clean(cfg="cfail2", except="hir_owner_nodes, optimized_mir")]
293 #[rustc_clean(cfg="cfail3")]
294 #[rustc_clean(cfg="cfail5", except="hir_owner_nodes, optimized_mir")]
295 #[rustc_clean(cfg="cfail6")]
296 pub fn change_continue_to_break() {