1 // Copyright 2016 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.
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.
12 // This test case tests the incremental compilation hash (ICH) implementation
15 // The general pattern followed here is: Change one thing between rev1 and rev2
16 // and make sure that the hash has changed, then change nothing between rev2 and
17 // rev3 and make sure that the hash has not changed.
19 // must-compile-successfully
20 // revisions: cfail1 cfail2 cfail3
21 // compile-flags: -Z query-dep-graph
24 #![feature(rustc_attrs)]
28 // Change loop body ------------------------------------------------------------
30 fn change_loop_body() {
39 #[rustc_dirty(label="Hir", cfg="cfail2")]
40 #[rustc_clean(label="Hir", cfg="cfail3")]
41 #[rustc_metadata_dirty(cfg="cfail2")]
42 #[rustc_metadata_clean(cfg="cfail3")]
43 fn change_loop_body() {
53 // Change iteration variable name ----------------------------------------------
55 fn change_iteration_variable_name() {
64 #[rustc_dirty(label="Hir", cfg="cfail2")]
65 #[rustc_clean(label="Hir", cfg="cfail3")]
66 #[rustc_metadata_dirty(cfg="cfail2")]
67 #[rustc_metadata_clean(cfg="cfail3")]
68 fn change_iteration_variable_name() {
78 // Change iteration variable pattern -------------------------------------------
80 fn change_iteration_variable_pattern() {
82 for _i in &[0, 1, 2] {
89 #[rustc_dirty(label="Hir", cfg="cfail2")]
90 #[rustc_clean(label="Hir", cfg="cfail3")]
91 #[rustc_metadata_dirty(cfg="cfail2")]
92 #[rustc_metadata_clean(cfg="cfail3")]
93 fn change_iteration_variable_pattern() {
95 for &_i in &[0, 1, 2] {
103 // Change iterable -------------------------------------------------------------
105 fn change_iterable() {
107 for _ in &[0, 1, 2] {
114 #[rustc_dirty(label="Hir", cfg="cfail2")]
115 #[rustc_clean(label="Hir", cfg="cfail3")]
116 #[rustc_metadata_dirty(cfg="cfail2")]
117 #[rustc_metadata_clean(cfg="cfail3")]
118 fn change_iterable() {
120 for _ in &[0, 1, 3] {
128 // Add break -------------------------------------------------------------------
138 #[rustc_dirty(label="Hir", cfg="cfail2")]
139 #[rustc_clean(label="Hir", cfg="cfail3")]
140 #[rustc_metadata_dirty(cfg="cfail2")]
141 #[rustc_metadata_clean(cfg="cfail3")]
152 // Add loop label --------------------------------------------------------------
154 fn add_loop_label() {
163 #[rustc_dirty(label="Hir", cfg="cfail2")]
164 #[rustc_clean(label="Hir", cfg="cfail3")]
165 #[rustc_metadata_dirty(cfg="cfail2")]
166 #[rustc_metadata_clean(cfg="cfail3")]
167 fn add_loop_label() {
169 'label: for _ in 0..1 {
177 // Add loop label to break -----------------------------------------------------
179 fn add_loop_label_to_break() {
181 'label: for _ in 0..1 {
188 #[rustc_dirty(label="Hir", cfg="cfail2")]
189 #[rustc_clean(label="Hir", cfg="cfail3")]
190 #[rustc_metadata_dirty(cfg="cfail2")]
191 #[rustc_metadata_clean(cfg="cfail3")]
192 fn add_loop_label_to_break() {
194 'label: for _ in 0..1 {
202 // Change break label ----------------------------------------------------------
204 fn change_break_label() {
206 'outer: for _ in 0..1 {
207 'inner: for _ in 0..1 {
215 #[rustc_dirty(label="Hir", cfg="cfail2")]
216 #[rustc_clean(label="Hir", cfg="cfail3")]
217 #[rustc_metadata_dirty(cfg="cfail2")]
218 #[rustc_metadata_clean(cfg="cfail3")]
219 fn change_break_label() {
221 'outer: for _ in 0..1 {
222 'inner: for _ in 0..1 {
231 // Add loop label to continue --------------------------------------------------
233 fn add_loop_label_to_continue() {
235 'label: for _ in 0..1 {
242 #[rustc_dirty(label="Hir", cfg="cfail2")]
243 #[rustc_clean(label="Hir", cfg="cfail3")]
244 #[rustc_metadata_dirty(cfg="cfail2")]
245 #[rustc_metadata_clean(cfg="cfail3")]
246 fn add_loop_label_to_continue() {
248 'label: for _ in 0..1 {
256 // Change continue label ----------------------------------------------------------
258 fn change_continue_label() {
260 'outer: for _ in 0..1 {
261 'inner: for _ in 0..1 {
269 #[rustc_dirty(label="Hir", cfg="cfail2")]
270 #[rustc_clean(label="Hir", cfg="cfail3")]
271 #[rustc_metadata_dirty(cfg="cfail2")]
272 #[rustc_metadata_clean(cfg="cfail3")]
273 fn change_continue_label() {
275 'outer: for _ in 0..1 {
276 'inner: for _ in 0..1 {
285 // Change continue to break ----------------------------------------------------
287 fn change_continue_to_break() {
296 #[rustc_dirty(label="Hir", cfg="cfail2")]
297 #[rustc_clean(label="Hir", cfg="cfail3")]
298 #[rustc_metadata_dirty(cfg="cfail2")]
299 #[rustc_metadata_clean(cfg="cfail3")]
300 fn change_continue_to_break() {