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 -O
11 // [cfail1]compile-flags: -Zincremental-ignore-spans
12 // [cfail2]compile-flags: -Zincremental-ignore-spans
13 // [cfail3]compile-flags: -Zincremental-ignore-spans
16 #![feature(rustc_attrs)]
20 // Change loop body ------------------------------------------------------------
21 #[cfg(any(cfail1,cfail4))]
22 pub fn change_loop_body() {
30 #[cfg(not(any(cfail1,cfail4)))]
31 #[rustc_clean(cfg="cfail2", except="hir_owner_nodes")]
32 #[rustc_clean(cfg="cfail3")]
33 #[rustc_clean(cfg="cfail5", except="hir_owner_nodes")]
34 #[rustc_clean(cfg="cfail6")]
35 pub fn change_loop_body() {
45 // Change iteration variable name ----------------------------------------------
46 #[cfg(any(cfail1,cfail4))]
47 pub fn change_iteration_variable_name() {
55 #[cfg(not(any(cfail1,cfail4)))]
56 #[rustc_clean(cfg="cfail2", except="hir_owner_nodes, optimized_mir")]
57 #[rustc_clean(cfg="cfail3")]
58 #[rustc_clean(cfg="cfail5", except="hir_owner_nodes, optimized_mir")]
59 #[rustc_clean(cfg="cfail6")]
60 pub fn change_iteration_variable_name() {
70 // Change iteration variable pattern -------------------------------------------
71 #[cfg(any(cfail1,cfail4))]
72 pub fn change_iteration_variable_pattern() {
74 for _i in &[0, 1, 2] {
80 #[cfg(not(any(cfail1,cfail4)))]
81 #[rustc_clean(cfg="cfail2", except="hir_owner_nodes, optimized_mir, typeck")]
82 #[rustc_clean(cfg="cfail3")]
83 #[rustc_clean(cfg="cfail5", except="hir_owner_nodes, optimized_mir, typeck")]
84 #[rustc_clean(cfg="cfail6")]
85 pub fn change_iteration_variable_pattern() {
87 for &_i in &[0, 1, 2] {
95 // Change iterable -------------------------------------------------------------
96 #[cfg(any(cfail1,cfail4))]
97 pub fn change_iterable() {
105 #[cfg(not(any(cfail1,cfail4)))]
106 #[rustc_clean(cfg="cfail2", except="hir_owner_nodes, promoted_mir")]
107 #[rustc_clean(cfg="cfail3")]
108 #[rustc_clean(cfg="cfail5", except="hir_owner_nodes, promoted_mir")]
109 #[rustc_clean(cfg="cfail6")]
110 pub fn change_iterable() {
112 for _ in &[0, 1, 3] {
120 // Add break -------------------------------------------------------------------
121 #[cfg(any(cfail1,cfail4))]
130 #[cfg(not(any(cfail1,cfail4)))]
131 #[rustc_clean(cfg="cfail2", except="hir_owner_nodes, optimized_mir, typeck")]
132 #[rustc_clean(cfg="cfail3")]
133 #[rustc_clean(cfg="cfail5", except="hir_owner_nodes, optimized_mir, typeck")]
134 #[rustc_clean(cfg="cfail6")]
145 // Add loop label --------------------------------------------------------------
146 #[cfg(any(cfail1,cfail4))]
147 pub fn add_loop_label() {
155 #[cfg(not(any(cfail1,cfail4)))]
156 #[rustc_clean(cfg="cfail2", except="hir_owner_nodes")]
157 #[rustc_clean(cfg="cfail3")]
158 #[rustc_clean(cfg="cfail5", except="hir_owner_nodes, optimized_mir")]
159 #[rustc_clean(cfg="cfail6")]
160 pub fn add_loop_label() {
162 'label: for _ in 0..1 {
170 // Add loop label to break -----------------------------------------------------
171 #[cfg(any(cfail1,cfail4))]
172 pub fn add_loop_label_to_break() {
174 'label: for _ in 0..1 {
180 #[cfg(not(any(cfail1,cfail4)))]
181 #[rustc_clean(cfg="cfail2", except="hir_owner_nodes")]
182 #[rustc_clean(cfg="cfail3")]
183 #[rustc_clean(cfg="cfail5", except="hir_owner_nodes")]
184 #[rustc_clean(cfg="cfail6")]
185 pub fn add_loop_label_to_break() {
187 'label: for _ in 0..1 {
195 // Change break label ----------------------------------------------------------
196 #[cfg(any(cfail1,cfail4))]
197 pub fn change_break_label() {
199 'outer: for _ in 0..1 {
200 'inner: for _ in 0..1 {
207 #[cfg(not(any(cfail1,cfail4)))]
208 #[rustc_clean(cfg="cfail2", except="hir_owner_nodes, optimized_mir")]
209 #[rustc_clean(cfg="cfail3")]
210 #[rustc_clean(cfg="cfail5", except="hir_owner_nodes, optimized_mir")]
211 #[rustc_clean(cfg="cfail6")]
212 pub fn change_break_label() {
214 'outer: for _ in 0..1 {
215 'inner: for _ in 0..1 {
224 // Add loop label to continue --------------------------------------------------
225 #[cfg(any(cfail1,cfail4))]
226 pub fn add_loop_label_to_continue() {
228 'label: for _ in 0..1 {
234 #[cfg(not(any(cfail1,cfail4)))]
235 #[rustc_clean(cfg="cfail2", except="hir_owner_nodes")]
236 #[rustc_clean(cfg="cfail3")]
237 #[rustc_clean(cfg="cfail5", except="hir_owner_nodes")]
238 #[rustc_clean(cfg="cfail6")]
239 pub fn add_loop_label_to_continue() {
241 'label: for _ in 0..1 {
249 // Change continue label ----------------------------------------------------------
250 #[cfg(any(cfail1,cfail4))]
251 pub fn change_continue_label() {
253 'outer: for _ in 0..1 {
254 'inner: for _ in 0..1 {
261 #[cfg(not(any(cfail1,cfail4)))]
262 #[rustc_clean(cfg="cfail2", except="hir_owner_nodes, optimized_mir")]
263 #[rustc_clean(cfg="cfail3")]
264 #[rustc_clean(cfg="cfail5", except="hir_owner_nodes, optimized_mir")]
265 #[rustc_clean(cfg="cfail6")]
266 pub fn change_continue_label() {
268 'outer: for _ in 0..1 {
269 'inner: for _ in 0..1 {
278 // Change continue to break ----------------------------------------------------
279 #[cfg(any(cfail1,cfail4))]
280 pub fn change_continue_to_break() {
288 #[cfg(not(any(cfail1,cfail4)))]
289 #[rustc_clean(cfg="cfail2", except="hir_owner_nodes, optimized_mir")]
290 #[rustc_clean(cfg="cfail3")]
291 #[rustc_clean(cfg="cfail5", except="hir_owner_nodes, optimized_mir")]
292 #[rustc_clean(cfg="cfail6")]
293 pub fn change_continue_to_break() {