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
13 // for `while let` loops.
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.
20 // revisions: cfail1 cfail2 cfail3
21 // compile-flags: -Z query-dep-graph -Zincremental-ignore-spans
24 #![feature(rustc_attrs)]
28 // Change loop body ------------------------------------------------------------
30 pub fn change_loop_body() {
32 while let Some(0u32) = None {
39 #[rustc_clean(cfg="cfail2", except="HirBody, MirValidated, MirOptimized")]
40 #[rustc_clean(cfg="cfail3")]
41 pub fn change_loop_body() {
43 while let Some(0u32) = None {
51 // Change loop body ------------------------------------------------------------
53 pub fn change_loop_condition() {
55 while let Some(0u32) = None {
62 #[rustc_clean(cfg="cfail2", except="HirBody, MirValidated, MirOptimized")]
63 #[rustc_clean(cfg="cfail3")]
64 pub fn change_loop_condition() {
66 while let Some(1u32) = None {
74 // Add break -------------------------------------------------------------------
78 while let Some(0u32) = None {
84 #[rustc_clean(cfg="cfail2", except="HirBody, MirValidated, MirOptimized, TypeckTables")]
85 #[rustc_clean(cfg="cfail3")]
88 while let Some(0u32) = None {
96 // Add loop label --------------------------------------------------------------
98 pub fn add_loop_label() {
100 while let Some(0u32) = None {
107 #[rustc_clean(cfg="cfail2", except="HirBody")]
108 #[rustc_clean(cfg="cfail3")]
109 pub fn add_loop_label() {
111 'label: while let Some(0u32) = None {
119 // Add loop label to break -----------------------------------------------------
121 pub fn add_loop_label_to_break() {
123 'label: while let Some(0u32) = None {
130 #[rustc_clean(cfg="cfail2", except="HirBody")]
131 #[rustc_clean(cfg="cfail3")]
132 pub fn add_loop_label_to_break() {
134 'label: while let Some(0u32) = None {
142 // Change break label ----------------------------------------------------------
144 pub fn change_break_label() {
146 'outer: while let Some(0u32) = None {
147 'inner: while let Some(0u32) = None {
155 #[rustc_clean(cfg="cfail2", except="HirBody, MirValidated, MirOptimized, TypeckTables")]
156 #[rustc_clean(cfg="cfail3")]
157 pub fn change_break_label() {
159 'outer: while let Some(0u32) = None {
160 'inner: while let Some(0u32) = None {
169 // Add loop label to continue --------------------------------------------------
171 pub fn add_loop_label_to_continue() {
173 'label: while let Some(0u32) = None {
180 #[rustc_clean(cfg="cfail2", except="HirBody")]
181 #[rustc_clean(cfg="cfail3")]
182 pub fn add_loop_label_to_continue() {
184 'label: while let Some(0u32) = None {
192 // Change continue label ----------------------------------------------------------
194 pub fn change_continue_label() {
196 'outer: while let Some(0u32) = None {
197 'inner: while let Some(0u32) = None {
205 #[rustc_clean(cfg="cfail2", except="HirBody, MirValidated, MirOptimized, TypeckTables")]
206 #[rustc_clean(cfg="cfail3")]
207 pub fn change_continue_label() {
209 'outer: while let Some(0u32) = None {
210 'inner: while let Some(0u32) = None {
219 // Change continue to break ----------------------------------------------------
221 pub fn change_continue_to_break() {
223 while let Some(0u32) = None {
230 #[rustc_clean(cfg="cfail2", except="HirBody, MirValidated, MirOptimized")]
231 #[rustc_clean(cfg="cfail3")]
232 pub fn change_continue_to_break() {
234 while let Some(0u32) = None {