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
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)]
32 // Change field value (struct-like) -----------------------------------------
33 #[cfg(any(cfail1,cfail4))]
34 pub fn change_field_value_struct_like() -> Enum
{
42 #[cfg(not(any(cfail1,cfail4)))]
43 #[rustc_clean(cfg="cfail2", except="hir_owner_nodes,optimized_mir")]
44 #[rustc_clean(cfg="cfail3")]
45 #[rustc_clean(cfg="cfail5", except="hir_owner_nodes,optimized_mir")]
46 #[rustc_clean(cfg="cfail6")]
47 pub fn change_field_value_struct_like() -> Enum
{
57 // Change field order (struct-like) -----------------------------------------
58 #[cfg(any(cfail1,cfail4))]
59 pub fn change_field_order_struct_like() -> Enum
{
67 #[cfg(not(any(cfail1,cfail4)))]
68 #[rustc_clean(cfg="cfail2", except="hir_owner_nodes,typeck")]
69 #[rustc_clean(cfg="cfail3")]
70 #[rustc_clean(cfg="cfail5", except="hir_owner_nodes,typeck,optimized_mir")]
71 #[rustc_clean(cfg="cfail6")]
72 // FIXME(michaelwoerister):Interesting. I would have thought that that changes the MIR. And it
73 // would if it were not all constants
74 pub fn change_field_order_struct_like() -> Enum
{
95 Tuple2(u64, u64, u64),
98 // Change constructor path (struct-like) ------------------------------------
99 #[cfg(any(cfail1,cfail4))]
100 pub fn change_constructor_path_struct_like() {
101 let _
= Enum
::Struct
{
108 #[cfg(not(any(cfail1,cfail4)))]
109 #[rustc_clean(cfg="cfail2", except="hir_owner_nodes,typeck")]
110 #[rustc_clean(cfg="cfail3")]
111 #[rustc_clean(cfg="cfail5", except="hir_owner_nodes,typeck")]
112 #[rustc_clean(cfg="cfail6")]
113 pub fn change_constructor_path_struct_like() {
114 let _
= Enum2
::Struct
{
123 // Change variant (regular struct) ------------------------------------
124 #[cfg(any(cfail1,cfail4))]
125 pub fn change_constructor_variant_struct_like() {
126 let _
= Enum2
::Struct
{
133 #[cfg(not(any(cfail1,cfail4)))]
134 #[rustc_clean(cfg="cfail2", except="hir_owner_nodes")]
135 #[rustc_clean(cfg="cfail3")]
136 #[rustc_clean(cfg="cfail5", except="hir_owner_nodes")]
137 #[rustc_clean(cfg="cfail6")]
138 pub fn change_constructor_variant_struct_like() {
139 let _
= Enum2
::Struct2
{
147 // Change constructor path indirectly (struct-like) -------------------------
148 pub mod change_constructor_path_indirectly_struct_like
{
149 #[cfg(any(cfail1,cfail4))]
150 use super::Enum
as TheEnum
;
151 #[cfg(not(any(cfail1,cfail4)))]
152 use super::Enum2
as TheEnum
;
156 except
="fn_sig,hir_owner,hir_owner_nodes,optimized_mir,\
159 #[rustc_clean(cfg="cfail3")]
162 except
="fn_sig,hir_owner,hir_owner_nodes,optimized_mir,\
165 #[rustc_clean(cfg="cfail6")]
166 pub fn function() -> TheEnum
{
176 // Change constructor variant indirectly (struct-like) ---------------------------
177 pub mod change_constructor_variant_indirectly_struct_like
{
179 #[cfg(any(cfail1,cfail4))]
180 use super::Enum2
::Struct
as Variant
;
181 #[cfg(not(any(cfail1,cfail4)))]
182 use super::Enum2
::Struct2
as Variant
;
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 function() -> Enum2
{
198 // Change field value (tuple-like) -------------------------------------------
199 #[cfg(any(cfail1,cfail4))]
200 pub fn change_field_value_tuple_like() -> Enum
{
204 #[cfg(not(any(cfail1,cfail4)))]
205 #[rustc_clean(cfg="cfail2", except="hir_owner_nodes,optimized_mir")]
206 #[rustc_clean(cfg="cfail3")]
207 #[rustc_clean(cfg="cfail5", except="hir_owner_nodes,optimized_mir")]
208 #[rustc_clean(cfg="cfail6")]
209 pub fn change_field_value_tuple_like() -> Enum
{
215 // Change constructor path (tuple-like) --------------------------------------
216 #[cfg(any(cfail1,cfail4))]
217 pub fn change_constructor_path_tuple_like() {
218 let _
= Enum
::Tuple(0, 1, 2);
221 #[cfg(not(any(cfail1,cfail4)))]
224 except
="hir_owner_nodes,typeck"
226 #[rustc_clean(cfg="cfail3")]
229 except
="hir_owner_nodes,typeck"
231 #[rustc_clean(cfg="cfail6")]
232 pub fn change_constructor_path_tuple_like() {
233 let _
= Enum2
::Tuple(0, 1, 2);
238 // Change constructor variant (tuple-like) --------------------------------------
239 #[cfg(any(cfail1,cfail4))]
240 pub fn change_constructor_variant_tuple_like() {
241 let _
= Enum2
::Tuple (0, 1, 2);
244 #[cfg(not(any(cfail1,cfail4)))]
247 except
="hir_owner_nodes,typeck"
249 #[rustc_clean(cfg="cfail3")]
252 except
="hir_owner_nodes,typeck"
254 #[rustc_clean(cfg="cfail6")]
255 pub fn change_constructor_variant_tuple_like() {
256 let _
= Enum2
::Tuple2(0, 1, 2);
260 // Change constructor path indirectly (tuple-like) ---------------------------
261 pub mod change_constructor_path_indirectly_tuple_like
{
262 #[cfg(any(cfail1,cfail4))]
263 use super::Enum
as TheEnum
;
264 #[cfg(not(any(cfail1,cfail4)))]
265 use super::Enum2
as TheEnum
;
269 except
="fn_sig,hir_owner,hir_owner_nodes,optimized_mir,\
272 #[rustc_clean(cfg="cfail3")]
275 except
="fn_sig,hir_owner,hir_owner_nodes,optimized_mir,\
278 #[rustc_clean(cfg="cfail6")]
279 pub fn function() -> TheEnum
{
280 TheEnum
::Tuple(0, 1, 2)
286 // Change constructor variant indirectly (tuple-like) ---------------------------
287 pub mod change_constructor_variant_indirectly_tuple_like
{
289 #[cfg(any(cfail1,cfail4))]
290 use super::Enum2
::Tuple
as Variant
;
291 #[cfg(not(any(cfail1,cfail4)))]
292 use super::Enum2
::Tuple2
as Variant
;
294 #[rustc_clean(cfg="cfail2", except="hir_owner_nodes,optimized_mir,typeck")]
295 #[rustc_clean(cfg="cfail3")]
296 #[rustc_clean(cfg="cfail5", except="hir_owner_nodes,optimized_mir,typeck")]
297 #[rustc_clean(cfg="cfail6")]
298 pub fn function() -> Enum2
{
316 // Change constructor path (C-like) --------------------------------------
317 #[cfg(any(cfail1,cfail4))]
318 pub fn change_constructor_path_c_like() {
322 #[cfg(not(any(cfail1,cfail4)))]
323 #[rustc_clean(cfg="cfail2", except="hir_owner_nodes,optimized_mir,typeck")]
324 #[rustc_clean(cfg="cfail3")]
325 #[rustc_clean(cfg="cfail5", except="hir_owner_nodes,optimized_mir,typeck")]
326 #[rustc_clean(cfg="cfail6")]
327 pub fn change_constructor_path_c_like() {
333 // Change constructor variant (C-like) --------------------------------------
334 #[cfg(any(cfail1,cfail4))]
335 pub fn change_constructor_variant_c_like() {
339 #[cfg(not(any(cfail1,cfail4)))]
340 #[rustc_clean(cfg="cfail2", except="hir_owner_nodes")]
341 #[rustc_clean(cfg="cfail3")]
342 #[rustc_clean(cfg="cfail5", except="hir_owner_nodes")]
343 #[rustc_clean(cfg="cfail6")]
344 pub fn change_constructor_variant_c_like() {
349 // Change constructor path indirectly (C-like) ---------------------------
350 pub mod change_constructor_path_indirectly_c_like
{
351 #[cfg(any(cfail1,cfail4))]
352 use super::Clike
as TheEnum
;
353 #[cfg(not(any(cfail1,cfail4)))]
354 use super::Clike2
as TheEnum
;
358 except
="fn_sig,hir_owner,hir_owner_nodes,optimized_mir,\
361 #[rustc_clean(cfg="cfail3")]
364 except
="fn_sig,hir_owner,hir_owner_nodes,optimized_mir,\
367 #[rustc_clean(cfg="cfail6")]
368 pub fn function() -> TheEnum
{
375 // Change constructor variant indirectly (C-like) ---------------------------
376 pub mod change_constructor_variant_indirectly_c_like
{
378 #[cfg(any(cfail1,cfail4))]
379 use super::Clike
::A
as Variant
;
380 #[cfg(not(any(cfail1,cfail4)))]
381 use super::Clike
::B
as Variant
;
383 #[rustc_clean(cfg="cfail2", except="hir_owner_nodes,optimized_mir")]
384 #[rustc_clean(cfg="cfail3")]
385 #[rustc_clean(cfg="cfail5", except="hir_owner_nodes,optimized_mir")]
386 #[rustc_clean(cfg="cfail6")]
387 pub fn function() -> Clike
{