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
16 #![feature(rustc_attrs)]
19 // Change condition (if)
20 #[cfg(any(cfail1,cfail4))]
21 pub fn change_condition(x: bool) -> u32 {
29 #[cfg(not(any(cfail1,cfail4)))]
30 #[rustc_clean(cfg="cfail2", except="hir_owner,hir_owner_nodes,optimized_mir,typeck")]
31 #[rustc_clean(cfg="cfail3")]
32 #[rustc_clean(cfg="cfail5", except="hir_owner,hir_owner_nodes,optimized_mir,typeck")]
33 #[rustc_clean(cfg="cfail6")]
34 pub fn change_condition(x: bool) -> u32 {
42 // Change then branch (if)
43 #[cfg(any(cfail1,cfail4))]
44 pub fn change_then_branch(x: bool) -> u32 {
52 #[cfg(not(any(cfail1,cfail4)))]
53 #[rustc_clean(cfg="cfail2", except="hir_owner_nodes,optimized_mir")]
54 #[rustc_clean(cfg="cfail3")]
55 #[rustc_clean(cfg="cfail5", except="hir_owner_nodes,optimized_mir")]
56 #[rustc_clean(cfg="cfail6")]
57 pub fn change_then_branch(x: bool) -> u32 {
67 // Change else branch (if)
68 #[cfg(any(cfail1,cfail4))]
69 pub fn change_else_branch(x: bool) -> u32 {
77 #[cfg(not(any(cfail1,cfail4)))]
78 #[rustc_clean(cfg="cfail2", except="hir_owner_nodes,optimized_mir")]
79 #[rustc_clean(cfg="cfail3")]
80 #[rustc_clean(cfg="cfail5", except="hir_owner_nodes,optimized_mir")]
81 #[rustc_clean(cfg="cfail6")]
82 pub fn change_else_branch(x: bool) -> u32 {
92 // Add else branch (if)
93 #[cfg(any(cfail1,cfail4))]
94 pub fn add_else_branch(x: bool) -> u32 {
105 #[cfg(not(any(cfail1,cfail4)))]
106 #[rustc_clean(cfg="cfail2", except="hir_owner,hir_owner_nodes,typeck")]
107 #[rustc_clean(cfg="cfail3")]
108 #[rustc_clean(cfg="cfail5", except="hir_owner,hir_owner_nodes,typeck")]
109 #[rustc_clean(cfg="cfail6")]
110 pub fn add_else_branch(x: bool) -> u32 {
123 // Change condition (if let)
124 #[cfg(any(cfail1,cfail4))]
125 pub fn change_condition_if_let(x: Option<u32>) -> u32 {
126 if let Some(_x) = x {
133 #[cfg(not(any(cfail1,cfail4)))]
134 #[rustc_clean(cfg="cfail2", except="hir_owner_nodes,optimized_mir,typeck")]
135 #[rustc_clean(cfg="cfail3")]
136 #[rustc_clean(cfg="cfail5", except="hir_owner_nodes,optimized_mir,typeck")]
137 #[rustc_clean(cfg="cfail6")]
138 pub fn change_condition_if_let(x: Option<u32>) -> u32 {
139 if let Some(_ ) = x {
148 // Change then branch (if let)
149 #[cfg(any(cfail1,cfail4))]
150 pub fn change_then_branch_if_let(x: Option<u32>) -> u32 {
158 #[cfg(not(any(cfail1,cfail4)))]
159 #[rustc_clean(cfg="cfail2", except="hir_owner,hir_owner_nodes,optimized_mir,typeck")]
160 #[rustc_clean(cfg="cfail3")]
161 #[rustc_clean(cfg="cfail5", except="hir_owner,hir_owner_nodes,optimized_mir,typeck")]
162 #[rustc_clean(cfg="cfail6")]
163 pub fn change_then_branch_if_let(x: Option<u32>) -> u32 {
173 // Change else branch (if let)
174 #[cfg(any(cfail1,cfail4))]
175 pub fn change_else_branch_if_let(x: Option<u32>) -> u32 {
183 #[cfg(not(any(cfail1,cfail4)))]
184 #[rustc_clean(cfg="cfail2", except="hir_owner_nodes,optimized_mir")]
185 #[rustc_clean(cfg="cfail3")]
186 #[rustc_clean(cfg="cfail5", except="hir_owner_nodes,optimized_mir")]
187 #[rustc_clean(cfg="cfail6")]
188 pub fn change_else_branch_if_let(x: Option<u32>) -> u32 {
198 // Add else branch (if let)
199 #[cfg(any(cfail1,cfail4))]
200 pub fn add_else_branch_if_let(x: Option<u32>) -> u32 {
211 #[cfg(not(any(cfail1,cfail4)))]
212 #[rustc_clean(cfg="cfail2", except="hir_owner,hir_owner_nodes,typeck")]
213 #[rustc_clean(cfg="cfail3")]
214 #[rustc_clean(cfg="cfail5", except="hir_owner,hir_owner_nodes,typeck,optimized_mir")]
215 #[rustc_clean(cfg="cfail6")]
216 pub fn add_else_branch_if_let(x: Option<u32>) -> u32 {