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
14 // [cfail4]compile-flags: -Zincremental-relative-spans
15 // [cfail5]compile-flags: -Zincremental-relative-spans
16 // [cfail6]compile-flags: -Zincremental-relative-spans
19 #![feature(rustc_attrs)]
22 // Change condition (if)
23 #[cfg(any(cfail1,cfail4))]
24 pub fn change_condition(x: bool) -> u32 {
32 #[cfg(not(any(cfail1,cfail4)))]
33 #[rustc_clean(cfg="cfail2", except="hir_owner,hir_owner_nodes,optimized_mir,typeck")]
34 #[rustc_clean(cfg="cfail3")]
35 #[rustc_clean(cfg="cfail5", except="hir_owner,hir_owner_nodes,optimized_mir,typeck")]
36 #[rustc_clean(cfg="cfail6")]
37 pub fn change_condition(x: bool) -> u32 {
45 // Change then branch (if)
46 #[cfg(any(cfail1,cfail4))]
47 pub fn change_then_branch(x: bool) -> u32 {
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_then_branch(x: bool) -> u32 {
70 // Change else branch (if)
71 #[cfg(any(cfail1,cfail4))]
72 pub fn change_else_branch(x: bool) -> u32 {
80 #[cfg(not(any(cfail1,cfail4)))]
81 #[rustc_clean(cfg="cfail2", except="hir_owner_nodes,optimized_mir")]
82 #[rustc_clean(cfg="cfail3")]
83 #[rustc_clean(cfg="cfail5", except="hir_owner_nodes,optimized_mir")]
84 #[rustc_clean(cfg="cfail6")]
85 pub fn change_else_branch(x: bool) -> u32 {
95 // Add else branch (if)
96 #[cfg(any(cfail1,cfail4))]
97 pub fn add_else_branch(x: bool) -> u32 {
108 #[cfg(not(any(cfail1,cfail4)))]
109 #[rustc_clean(cfg="cfail2", except="hir_owner,hir_owner_nodes,typeck")]
110 #[rustc_clean(cfg="cfail3")]
111 #[rustc_clean(cfg="cfail5", except="hir_owner,hir_owner_nodes,typeck")]
112 #[rustc_clean(cfg="cfail6")]
113 pub fn add_else_branch(x: bool) -> u32 {
126 // Change condition (if let)
127 #[cfg(any(cfail1,cfail4))]
128 pub fn change_condition_if_let(x: Option<u32>) -> u32 {
129 if let Some(_x) = x {
136 #[cfg(not(any(cfail1,cfail4)))]
137 #[rustc_clean(cfg="cfail2", except="hir_owner_nodes,optimized_mir,typeck")]
138 #[rustc_clean(cfg="cfail3")]
139 #[rustc_clean(cfg="cfail5", except="hir_owner_nodes,optimized_mir,typeck")]
140 #[rustc_clean(cfg="cfail6")]
141 pub fn change_condition_if_let(x: Option<u32>) -> u32 {
142 if let Some(_ ) = x {
151 // Change then branch (if let)
152 #[cfg(any(cfail1,cfail4))]
153 pub fn change_then_branch_if_let(x: Option<u32>) -> u32 {
161 #[cfg(not(any(cfail1,cfail4)))]
162 #[rustc_clean(cfg="cfail2", except="hir_owner,hir_owner_nodes,optimized_mir,typeck")]
163 #[rustc_clean(cfg="cfail3")]
164 #[rustc_clean(cfg="cfail5", except="hir_owner,hir_owner_nodes,optimized_mir,typeck")]
165 #[rustc_clean(cfg="cfail6")]
166 pub fn change_then_branch_if_let(x: Option<u32>) -> u32 {
176 // Change else branch (if let)
177 #[cfg(any(cfail1,cfail4))]
178 pub fn change_else_branch_if_let(x: Option<u32>) -> u32 {
186 #[cfg(not(any(cfail1,cfail4)))]
187 #[rustc_clean(cfg="cfail2", except="hir_owner_nodes,optimized_mir")]
188 #[rustc_clean(cfg="cfail3")]
189 #[rustc_clean(cfg="cfail5", except="hir_owner_nodes,optimized_mir")]
190 #[rustc_clean(cfg="cfail6")]
191 pub fn change_else_branch_if_let(x: Option<u32>) -> u32 {
201 // Add else branch (if let)
202 #[cfg(any(cfail1,cfail4))]
203 pub fn add_else_branch_if_let(x: Option<u32>) -> u32 {
214 #[cfg(not(any(cfail1,cfail4)))]
215 #[rustc_clean(cfg="cfail2", except="hir_owner,hir_owner_nodes,typeck")]
216 #[rustc_clean(cfg="cfail3")]
217 #[rustc_clean(cfg="cfail5", except="hir_owner,hir_owner_nodes,typeck,optimized_mir")]
218 #[rustc_clean(cfg="cfail6")]
219 pub fn add_else_branch_if_let(x: Option<u32>) -> u32 {