]>
git.proxmox.com Git - rustc.git/blob - src/test/incremental/hashes/if_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 if 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 // Change condition (if) -------------------------------------------------------
30 pub fn change_condition(x
: bool
) -> u32 {
39 #[rustc_clean(cfg="cfail2", except="HirBody,MirValidated,MirOptimized,TypeckTables")]
40 #[rustc_clean(cfg="cfail3")]
41 #[rustc_metadata_clean(cfg="cfail2")]
42 #[rustc_metadata_clean(cfg="cfail3")]
43 pub fn change_condition(x
: bool
) -> u32 {
51 // Change then branch (if) -----------------------------------------------------
53 pub fn change_then_branch(x
: bool
) -> u32 {
62 #[rustc_clean(cfg="cfail2", except="HirBody,MirValidated,MirOptimized")]
63 #[rustc_clean(cfg="cfail3")]
64 #[rustc_metadata_clean(cfg="cfail2")]
65 #[rustc_metadata_clean(cfg="cfail3")]
66 pub fn change_then_branch(x
: bool
) -> u32 {
76 // Change else branch (if) -----------------------------------------------------
78 pub fn change_else_branch(x
: bool
) -> u32 {
87 #[rustc_clean(cfg="cfail2", except="HirBody,MirValidated,MirOptimized")]
88 #[rustc_clean(cfg="cfail3")]
89 #[rustc_metadata_clean(cfg="cfail2")]
90 #[rustc_metadata_clean(cfg="cfail3")]
91 pub fn change_else_branch(x
: bool
) -> u32 {
101 // Add else branch (if) --------------------------------------------------------
103 pub fn add_else_branch(x
: bool
) -> u32 {
114 #[rustc_clean(cfg="cfail2", except="HirBody,TypeckTables")]
115 #[rustc_clean(cfg="cfail3")]
116 #[rustc_metadata_clean(cfg="cfail2")]
117 #[rustc_metadata_clean(cfg="cfail3")]
118 pub fn add_else_branch(x
: bool
) -> u32 {
131 // Change condition (if let) ---------------------------------------------------
133 pub fn change_condition_if_let(x
: Option
<u32>) -> u32 {
134 if let Some(_x
) = x
{
142 #[rustc_clean(cfg="cfail2", except="HirBody,MirValidated,MirOptimized,TypeckTables")]
143 #[rustc_clean(cfg="cfail3")]
144 #[rustc_metadata_clean(cfg="cfail2")]
145 #[rustc_metadata_clean(cfg="cfail3")]
146 pub fn change_condition_if_let(x
: Option
<u32>) -> u32 {
156 // Change then branch (if let) -------------------------------------------------
158 pub fn change_then_branch_if_let(x
: Option
<u32>) -> u32 {
167 #[rustc_clean(cfg="cfail2", except="HirBody,MirValidated,MirOptimized,TypeckTables")]
168 #[rustc_clean(cfg="cfail3")]
169 #[rustc_metadata_clean(cfg="cfail2")]
170 #[rustc_metadata_clean(cfg="cfail3")]
171 pub fn change_then_branch_if_let(x
: Option
<u32>) -> u32 {
181 // Change else branch (if let) -------------------------------------------------
183 pub fn change_else_branch_if_let(x
: Option
<u32>) -> u32 {
192 #[rustc_clean(cfg="cfail2", except="HirBody,MirValidated,MirOptimized")]
193 #[rustc_clean(cfg="cfail3")]
194 #[rustc_metadata_clean(cfg="cfail2")]
195 #[rustc_metadata_clean(cfg="cfail3")]
196 pub fn change_else_branch_if_let(x
: Option
<u32>) -> u32 {
206 // Add else branch (if let) ----------------------------------------------------
208 pub fn add_else_branch_if_let(x
: Option
<u32>) -> u32 {
219 #[rustc_clean(cfg="cfail2", except="HirBody,TypeckTables")]
220 #[rustc_clean(cfg="cfail3")]
221 #[rustc_metadata_clean(cfg="cfail2")]
222 #[rustc_metadata_clean(cfg="cfail3")]
223 pub fn add_else_branch_if_let(x
: Option
<u32>) -> u32 {