1 // This test case tests the incremental compilation hash (ICH) implementation
2 // for struct constructor expressions.
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)]
29 // Change field value (struct-like) -----------------------------------------
30 #[cfg(any(cfail1,cfail4))]
31 pub fn change_field_value_struct_like() -> Enum {
39 #[cfg(not(any(cfail1,cfail4)))]
40 #[rustc_clean(cfg="cfail2", except="hir_owner_nodes,optimized_mir")]
41 #[rustc_clean(cfg="cfail3")]
42 #[rustc_clean(cfg="cfail5", except="hir_owner_nodes,optimized_mir")]
43 #[rustc_clean(cfg="cfail6")]
44 pub fn change_field_value_struct_like() -> Enum {
54 // Change field order (struct-like) -----------------------------------------
55 #[cfg(any(cfail1,cfail4))]
56 pub fn change_field_order_struct_like() -> Enum {
64 #[cfg(not(any(cfail1,cfail4)))]
65 #[rustc_clean(cfg="cfail2", except="hir_owner_nodes,typeck")]
66 #[rustc_clean(cfg="cfail3")]
67 #[rustc_clean(cfg="cfail5", except="hir_owner_nodes,typeck,optimized_mir")]
68 #[rustc_clean(cfg="cfail6")]
69 // FIXME(michaelwoerister):Interesting. I would have thought that that changes the MIR. And it
70 // would if it were not all constants
71 pub fn change_field_order_struct_like() -> Enum {
92 Tuple2(u64, u64, u64),
95 // Change constructor path (struct-like) ------------------------------------
96 #[cfg(any(cfail1,cfail4))]
97 pub fn change_constructor_path_struct_like() {
98 let _ = Enum ::Struct {
105 #[cfg(not(any(cfail1,cfail4)))]
106 #[rustc_clean(cfg="cfail2", except="hir_owner_nodes,typeck")]
107 #[rustc_clean(cfg="cfail3")]
108 #[rustc_clean(cfg="cfail5", except="hir_owner_nodes,typeck")]
109 #[rustc_clean(cfg="cfail6")]
110 pub fn change_constructor_path_struct_like() {
111 let _ = Enum2::Struct {
120 // Change variant (regular struct) ------------------------------------
121 #[cfg(any(cfail1,cfail4))]
122 pub fn change_constructor_variant_struct_like() {
123 let _ = Enum2::Struct {
130 #[cfg(not(any(cfail1,cfail4)))]
131 #[rustc_clean(cfg="cfail2", except="hir_owner_nodes")]
132 #[rustc_clean(cfg="cfail3")]
133 #[rustc_clean(cfg="cfail5", except="hir_owner_nodes")]
134 #[rustc_clean(cfg="cfail6")]
135 pub fn change_constructor_variant_struct_like() {
136 let _ = Enum2::Struct2 {
144 // Change constructor path indirectly (struct-like) -------------------------
145 pub mod change_constructor_path_indirectly_struct_like {
146 #[cfg(any(cfail1,cfail4))]
147 use super::Enum as TheEnum;
148 #[cfg(not(any(cfail1,cfail4)))]
149 use super::Enum2 as TheEnum;
153 except="fn_sig,hir_owner,hir_owner_nodes,optimized_mir,\
156 #[rustc_clean(cfg="cfail3")]
159 except="fn_sig,hir_owner,hir_owner_nodes,optimized_mir,\
162 #[rustc_clean(cfg="cfail6")]
163 pub fn function() -> TheEnum {
173 // Change constructor variant indirectly (struct-like) ---------------------------
174 pub mod change_constructor_variant_indirectly_struct_like {
176 #[cfg(any(cfail1,cfail4))]
177 use super::Enum2::Struct as Variant;
178 #[cfg(not(any(cfail1,cfail4)))]
179 use super::Enum2::Struct2 as Variant;
181 #[rustc_clean(cfg="cfail2", except="hir_owner_nodes,optimized_mir")]
182 #[rustc_clean(cfg="cfail3")]
183 #[rustc_clean(cfg="cfail5", except="hir_owner_nodes,optimized_mir")]
184 #[rustc_clean(cfg="cfail6")]
185 pub fn function() -> Enum2 {
195 // Change field value (tuple-like) -------------------------------------------
196 #[cfg(any(cfail1,cfail4))]
197 pub fn change_field_value_tuple_like() -> Enum {
201 #[cfg(not(any(cfail1,cfail4)))]
202 #[rustc_clean(cfg="cfail2", except="hir_owner_nodes,optimized_mir")]
203 #[rustc_clean(cfg="cfail3")]
204 #[rustc_clean(cfg="cfail5", except="hir_owner_nodes,optimized_mir")]
205 #[rustc_clean(cfg="cfail6")]
206 pub fn change_field_value_tuple_like() -> Enum {
212 // Change constructor path (tuple-like) --------------------------------------
213 #[cfg(any(cfail1,cfail4))]
214 pub fn change_constructor_path_tuple_like() {
215 let _ = Enum ::Tuple(0, 1, 2);
218 #[cfg(not(any(cfail1,cfail4)))]
221 except="hir_owner_nodes,typeck"
223 #[rustc_clean(cfg="cfail3")]
226 except="hir_owner_nodes,typeck"
228 #[rustc_clean(cfg="cfail6")]
229 pub fn change_constructor_path_tuple_like() {
230 let _ = Enum2::Tuple(0, 1, 2);
235 // Change constructor variant (tuple-like) --------------------------------------
236 #[cfg(any(cfail1,cfail4))]
237 pub fn change_constructor_variant_tuple_like() {
238 let _ = Enum2::Tuple (0, 1, 2);
241 #[cfg(not(any(cfail1,cfail4)))]
244 except="hir_owner_nodes,typeck"
246 #[rustc_clean(cfg="cfail3")]
249 except="hir_owner_nodes,typeck"
251 #[rustc_clean(cfg="cfail6")]
252 pub fn change_constructor_variant_tuple_like() {
253 let _ = Enum2::Tuple2(0, 1, 2);
257 // Change constructor path indirectly (tuple-like) ---------------------------
258 pub mod change_constructor_path_indirectly_tuple_like {
259 #[cfg(any(cfail1,cfail4))]
260 use super::Enum as TheEnum;
261 #[cfg(not(any(cfail1,cfail4)))]
262 use super::Enum2 as TheEnum;
266 except="fn_sig,hir_owner,hir_owner_nodes,optimized_mir,\
269 #[rustc_clean(cfg="cfail3")]
272 except="fn_sig,hir_owner,hir_owner_nodes,optimized_mir,\
275 #[rustc_clean(cfg="cfail6")]
276 pub fn function() -> TheEnum {
277 TheEnum::Tuple(0, 1, 2)
283 // Change constructor variant indirectly (tuple-like) ---------------------------
284 pub mod change_constructor_variant_indirectly_tuple_like {
286 #[cfg(any(cfail1,cfail4))]
287 use super::Enum2::Tuple as Variant;
288 #[cfg(not(any(cfail1,cfail4)))]
289 use super::Enum2::Tuple2 as Variant;
291 #[rustc_clean(cfg="cfail2", except="hir_owner_nodes,optimized_mir,typeck")]
292 #[rustc_clean(cfg="cfail3")]
293 #[rustc_clean(cfg="cfail5", except="hir_owner_nodes,optimized_mir,typeck")]
294 #[rustc_clean(cfg="cfail6")]
295 pub fn function() -> Enum2 {
313 // Change constructor path (C-like) --------------------------------------
314 #[cfg(any(cfail1,cfail4))]
315 pub fn change_constructor_path_c_like() {
319 #[cfg(not(any(cfail1,cfail4)))]
320 #[rustc_clean(cfg="cfail2", except="hir_owner_nodes,optimized_mir,typeck")]
321 #[rustc_clean(cfg="cfail3")]
322 #[rustc_clean(cfg="cfail5", except="hir_owner_nodes,optimized_mir,typeck")]
323 #[rustc_clean(cfg="cfail6")]
324 pub fn change_constructor_path_c_like() {
330 // Change constructor variant (C-like) --------------------------------------
331 #[cfg(any(cfail1,cfail4))]
332 pub fn change_constructor_variant_c_like() {
336 #[cfg(not(any(cfail1,cfail4)))]
337 #[rustc_clean(cfg="cfail2", except="hir_owner_nodes")]
338 #[rustc_clean(cfg="cfail3")]
339 #[rustc_clean(cfg="cfail5", except="hir_owner_nodes")]
340 #[rustc_clean(cfg="cfail6")]
341 pub fn change_constructor_variant_c_like() {
346 // Change constructor path indirectly (C-like) ---------------------------
347 pub mod change_constructor_path_indirectly_c_like {
348 #[cfg(any(cfail1,cfail4))]
349 use super::Clike as TheEnum;
350 #[cfg(not(any(cfail1,cfail4)))]
351 use super::Clike2 as TheEnum;
355 except="fn_sig,hir_owner,hir_owner_nodes,optimized_mir,\
358 #[rustc_clean(cfg="cfail3")]
361 except="fn_sig,hir_owner,hir_owner_nodes,optimized_mir,\
364 #[rustc_clean(cfg="cfail6")]
365 pub fn function() -> TheEnum {
372 // Change constructor variant indirectly (C-like) ---------------------------
373 pub mod change_constructor_variant_indirectly_c_like {
375 #[cfg(any(cfail1,cfail4))]
376 use super::Clike::A as Variant;
377 #[cfg(not(any(cfail1,cfail4)))]
378 use super::Clike::B as Variant;
380 #[rustc_clean(cfg="cfail2", except="hir_owner_nodes,optimized_mir")]
381 #[rustc_clean(cfg="cfail3")]
382 #[rustc_clean(cfg="cfail5", except="hir_owner_nodes,optimized_mir")]
383 #[rustc_clean(cfg="cfail6")]
384 pub fn function() -> Clike {