]>
git.proxmox.com Git - rustc.git/blob - src/test/incremental/hashes/match_expressions.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
13 // for match expressions.
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
25 #![feature(rustc_attrs)]
28 // Add Arm ---------------------------------------------------------------------
30 pub fn add_arm(x
: u32) -> u32 {
39 #[rustc_clean(label="Hir", cfg="cfail2")]
40 #[rustc_clean(label="Hir", cfg="cfail3")]
41 #[rustc_dirty(label="HirBody", cfg="cfail2")]
42 #[rustc_clean(label="HirBody", cfg="cfail3")]
43 #[rustc_metadata_clean(cfg="cfail2")]
44 #[rustc_metadata_clean(cfg="cfail3")]
45 pub fn add_arm(x
: u32) -> u32 {
56 // Change Order Of Arms --------------------------------------------------------
58 pub fn change_order_of_arms(x
: u32) -> u32 {
67 #[rustc_clean(label="Hir", cfg="cfail2")]
68 #[rustc_clean(label="Hir", cfg="cfail3")]
69 #[rustc_dirty(label="HirBody", cfg="cfail2")]
70 #[rustc_clean(label="HirBody", cfg="cfail3")]
71 #[rustc_metadata_clean(cfg="cfail2")]
72 #[rustc_metadata_clean(cfg="cfail3")]
73 pub fn change_order_of_arms(x
: u32) -> u32 {
83 // Add Guard Clause ------------------------------------------------------------
85 pub fn add_guard_clause(x
: u32, y
: bool
) -> u32 {
94 #[rustc_clean(label="Hir", cfg="cfail2")]
95 #[rustc_clean(label="Hir", cfg="cfail3")]
96 #[rustc_dirty(label="HirBody", cfg="cfail2")]
97 #[rustc_clean(label="HirBody", cfg="cfail3")]
98 #[rustc_metadata_clean(cfg="cfail2")]
99 #[rustc_metadata_clean(cfg="cfail3")]
100 pub fn add_guard_clause(x
: u32, y
: bool
) -> u32 {
110 // Change Guard Clause ------------------------------------------------------------
112 pub fn change_guard_clause(x
: u32, y
: bool
) -> u32 {
121 #[rustc_clean(label="Hir", cfg="cfail2")]
122 #[rustc_clean(label="Hir", cfg="cfail3")]
123 #[rustc_dirty(label="HirBody", cfg="cfail2")]
124 #[rustc_clean(label="HirBody", cfg="cfail3")]
125 #[rustc_metadata_clean(cfg="cfail2")]
126 #[rustc_metadata_clean(cfg="cfail3")]
127 pub fn change_guard_clause(x
: u32, y
: bool
) -> u32 {
137 // Add @-Binding ---------------------------------------------------------------
139 pub fn add_at_binding(x
: u32) -> u32 {
148 #[rustc_clean(label="Hir", cfg="cfail2")]
149 #[rustc_clean(label="Hir", cfg="cfail3")]
150 #[rustc_dirty(label="HirBody", cfg="cfail2")]
151 #[rustc_clean(label="HirBody", cfg="cfail3")]
152 #[rustc_metadata_clean(cfg="cfail2")]
153 #[rustc_metadata_clean(cfg="cfail3")]
154 pub fn add_at_binding(x
: u32) -> u32 {
164 // Change Name of @-Binding ----------------------------------------------------
166 pub fn change_name_of_at_binding(x
: u32) -> u32 {
175 #[rustc_clean(label="Hir", cfg="cfail2")]
176 #[rustc_clean(label="Hir", cfg="cfail3")]
177 #[rustc_dirty(label="HirBody", cfg="cfail2")]
178 #[rustc_clean(label="HirBody", cfg="cfail3")]
179 #[rustc_metadata_clean(cfg="cfail2")]
180 #[rustc_metadata_clean(cfg="cfail3")]
181 pub fn change_name_of_at_binding(x
: u32) -> u32 {
191 // Change Simple Binding To Pattern --------------------------------------------
193 pub fn change_simple_name_to_pattern(x
: u32) -> u32 {
201 #[rustc_clean(label="Hir", cfg="cfail2")]
202 #[rustc_clean(label="Hir", cfg="cfail3")]
203 #[rustc_dirty(label="HirBody", cfg="cfail2")]
204 #[rustc_clean(label="HirBody", cfg="cfail3")]
205 #[rustc_metadata_clean(cfg="cfail2")]
206 #[rustc_metadata_clean(cfg="cfail3")]
207 pub fn change_simple_name_to_pattern(x
: u32) -> u32 {
216 // Change Name In Pattern ------------------------------------------------------
218 pub fn change_name_in_pattern(x
: u32) -> u32 {
227 #[rustc_clean(label="Hir", cfg="cfail2")]
228 #[rustc_clean(label="Hir", cfg="cfail3")]
229 #[rustc_dirty(label="HirBody", cfg="cfail2")]
230 #[rustc_clean(label="HirBody", cfg="cfail3")]
231 #[rustc_metadata_clean(cfg="cfail2")]
232 #[rustc_metadata_clean(cfg="cfail3")]
233 pub fn change_name_in_pattern(x
: u32) -> u32 {
243 // Change Mutability Of Binding In Pattern -------------------------------------
245 pub fn change_mutability_of_binding_in_pattern(x
: u32) -> u32 {
253 #[rustc_clean(label="Hir", cfg="cfail2")]
254 #[rustc_clean(label="Hir", cfg="cfail3")]
255 #[rustc_dirty(label="HirBody", cfg="cfail2")]
256 #[rustc_clean(label="HirBody", cfg="cfail3")]
257 #[rustc_metadata_clean(cfg="cfail2")]
258 #[rustc_metadata_clean(cfg="cfail3")]
259 pub fn change_mutability_of_binding_in_pattern(x
: u32) -> u32 {
268 // Add `ref` To Binding In Pattern -------------------------------------
270 pub fn add_ref_to_binding_in_pattern(x
: u32) -> u32 {
278 #[rustc_clean(label="Hir", cfg="cfail2")]
279 #[rustc_clean(label="Hir", cfg="cfail3")]
280 #[rustc_dirty(label="HirBody", cfg="cfail2")]
281 #[rustc_clean(label="HirBody", cfg="cfail3")]
282 #[rustc_metadata_clean(cfg="cfail2")]
283 #[rustc_metadata_clean(cfg="cfail3")]
284 pub fn add_ref_to_binding_in_pattern(x
: u32) -> u32 {
293 // Add `&` To Binding In Pattern -------------------------------------
295 pub fn add_amp_to_binding_in_pattern(x
: u32) -> u32 {
303 #[rustc_clean(label="Hir", cfg="cfail2")]
304 #[rustc_clean(label="Hir", cfg="cfail3")]
305 #[rustc_dirty(label="HirBody", cfg="cfail2")]
306 #[rustc_clean(label="HirBody", cfg="cfail3")]
307 #[rustc_metadata_clean(cfg="cfail2")]
308 #[rustc_metadata_clean(cfg="cfail3")]
309 pub fn add_amp_to_binding_in_pattern(x
: u32) -> u32 {
318 // Change RHS Of Arm -----------------------------------------------------------
320 pub fn change_rhs_of_arm(x
: u32) -> u32 {
329 #[rustc_clean(label="Hir", cfg="cfail2")]
330 #[rustc_clean(label="Hir", cfg="cfail3")]
331 #[rustc_dirty(label="HirBody", cfg="cfail2")]
332 #[rustc_clean(label="HirBody", cfg="cfail3")]
333 #[rustc_metadata_clean(cfg="cfail2")]
334 #[rustc_metadata_clean(cfg="cfail3")]
335 pub fn change_rhs_of_arm(x
: u32) -> u32 {
345 // Add Alternative To Arm ------------------------------------------------------
347 pub fn add_alternative_to_arm(x
: u32) -> u32 {
356 #[rustc_clean(label="Hir", cfg="cfail2")]
357 #[rustc_clean(label="Hir", cfg="cfail3")]
358 #[rustc_dirty(label="HirBody", cfg="cfail2")]
359 #[rustc_clean(label="HirBody", cfg="cfail3")]
360 #[rustc_metadata_clean(cfg="cfail2")]
361 #[rustc_metadata_clean(cfg="cfail3")]
362 pub fn add_alternative_to_arm(x
: u32) -> u32 {