]>
git.proxmox.com Git - rustc.git/blob - src/test/incremental/hashes/for_loops.rs
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.
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() {
39 #[rustc_clean(cfg="cfail2", except="HirBody, MirValidated, MirOptimized")]
40 #[rustc_clean(cfg="cfail3")]
41 pub fn change_loop_body() {
51 // Change iteration variable name ----------------------------------------------
53 pub fn change_iteration_variable_name() {
62 #[rustc_clean(cfg="cfail2", except="HirBody, MirValidated, MirOptimized")]
63 #[rustc_clean(cfg="cfail3")]
64 pub fn change_iteration_variable_name() {
74 // Change iteration variable pattern -------------------------------------------
76 pub fn change_iteration_variable_pattern() {
78 for _i
in &[0, 1, 2] {
85 #[rustc_clean(cfg="cfail2", except="HirBody, MirValidated, MirOptimized, TypeckTables")]
86 #[rustc_clean(cfg="cfail3")]
87 pub fn change_iteration_variable_pattern() {
89 for &_i
in &[0, 1, 2] {
97 // Change iterable -------------------------------------------------------------
99 pub fn change_iterable() {
101 for _
in &[0, 1, 2] {
108 #[rustc_clean(cfg="cfail2", except="HirBody, MirValidated, MirOptimized")]
109 #[rustc_clean(cfg="cfail3")]
110 pub fn change_iterable() {
112 for _
in &[0, 1, 3] {
120 // Add break -------------------------------------------------------------------
130 #[rustc_clean(cfg="cfail2", except="HirBody, MirValidated, MirOptimized, TypeckTables")]
131 #[rustc_clean(cfg="cfail3")]
142 // Add loop label --------------------------------------------------------------
144 pub fn add_loop_label() {
153 #[rustc_clean(cfg="cfail2", except="HirBody")]
154 #[rustc_clean(cfg="cfail3")]
155 pub fn add_loop_label() {
157 'label
: for _
in 0..1 {
165 // Add loop label to break -----------------------------------------------------
167 pub fn add_loop_label_to_break() {
169 'label
: for _
in 0..1 {
176 #[rustc_clean(cfg="cfail2", except="HirBody")]
177 #[rustc_clean(cfg="cfail3")]
178 pub fn add_loop_label_to_break() {
180 'label
: for _
in 0..1 {
188 // Change break label ----------------------------------------------------------
190 pub fn change_break_label() {
192 'outer
: for _
in 0..1 {
193 'inner
: for _
in 0..1 {
201 #[rustc_clean(cfg="cfail2", except="HirBody, MirValidated, MirOptimized")]
202 #[rustc_clean(cfg="cfail3")]
203 pub fn change_break_label() {
205 'outer
: for _
in 0..1 {
206 'inner
: for _
in 0..1 {
215 // Add loop label to continue --------------------------------------------------
217 pub fn add_loop_label_to_continue() {
219 'label
: for _
in 0..1 {
226 #[rustc_clean(cfg="cfail2", except="HirBody")]
227 #[rustc_clean(cfg="cfail3")]
228 pub fn add_loop_label_to_continue() {
230 'label
: for _
in 0..1 {
238 // Change continue label ----------------------------------------------------------
240 pub fn change_continue_label() {
242 'outer
: for _
in 0..1 {
243 'inner
: for _
in 0..1 {
251 #[rustc_clean(cfg="cfail2", except="HirBody, MirValidated, MirOptimized")]
252 #[rustc_clean(cfg="cfail3")]
253 pub fn change_continue_label() {
255 'outer
: for _
in 0..1 {
256 'inner
: for _
in 0..1 {
265 // Change continue to break ----------------------------------------------------
267 pub fn change_continue_to_break() {
276 #[rustc_clean(cfg="cfail2", except="HirBody, MirValidated, MirOptimized")]
277 #[rustc_clean(cfg="cfail3")]
278 pub fn change_continue_to_break() {