]> git.lizzy.rs Git - rust.git/blob - tests/incremental/hashes/enum_defs.rs
Rollup merge of #105784 - yanns:update_stdarch, r=Amanieu
[rust.git] / tests / incremental / hashes / enum_defs.rs
1 // This test case tests the incremental compilation hash (ICH) implementation
2 // for enum definitions.
3
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.
7
8 // We also test the ICH for enum definitions exported in metadata. Same as
9 // above, we want to make sure that the change between rev1 and rev2 also
10 // results in a change of the ICH for the enum's metadata, and that it stays
11 // the same between rev2 and rev3.
12
13 // build-pass (FIXME(62277): could be check-pass?)
14 // revisions: cfail1 cfail2 cfail3 cfail4 cfail5 cfail6
15 // compile-flags: -Z query-dep-graph -O
16 // [cfail1]compile-flags: -Zincremental-ignore-spans
17 // [cfail2]compile-flags: -Zincremental-ignore-spans
18 // [cfail3]compile-flags: -Zincremental-ignore-spans
19
20 #![allow(warnings)]
21 #![feature(rustc_attrs)]
22 #![feature(stmt_expr_attributes)]
23 #![crate_type="rlib"]
24
25
26
27 // Change enum visibility -----------------------------------------------------
28 #[cfg(any(cfail1,cfail4))]
29 enum     EnumVisibility { A }
30
31 #[cfg(not(any(cfail1,cfail4)))]
32 #[rustc_clean(cfg="cfail2")]
33 #[rustc_clean(cfg="cfail3")]
34 #[rustc_clean(cfg="cfail5", except="hir_owner,hir_owner_nodes")]
35 #[rustc_clean(cfg="cfail6")]
36 pub enum EnumVisibility { A }
37
38
39
40 // Change name of a c-style variant -------------------------------------------
41 #[cfg(any(cfail1,cfail4))]
42 enum EnumChangeNameCStyleVariant {
43     Variant1,
44     Variant2,
45 }
46
47 #[cfg(not(any(cfail1,cfail4)))]
48 #[rustc_clean(cfg="cfail2", except="hir_owner,hir_owner_nodes,type_of")]
49 #[rustc_clean(cfg="cfail3")]
50 #[rustc_clean(cfg="cfail5", except="hir_owner,hir_owner_nodes,type_of")]
51 #[rustc_clean(cfg="cfail6")]
52 enum EnumChangeNameCStyleVariant {
53     Variant1,
54     Variant2Changed,
55 }
56
57
58
59 // Change name of a tuple-style variant ---------------------------------------
60 #[cfg(any(cfail1,cfail4))]
61 enum EnumChangeNameTupleStyleVariant {
62     Variant1,
63     Variant2(u32, f32),
64 }
65
66 #[cfg(not(any(cfail1,cfail4)))]
67 #[rustc_clean(cfg="cfail2", except="hir_owner,hir_owner_nodes,type_of")]
68 #[rustc_clean(cfg="cfail3")]
69 #[rustc_clean(cfg="cfail5", except="hir_owner,hir_owner_nodes,type_of")]
70 #[rustc_clean(cfg="cfail6")]
71 enum EnumChangeNameTupleStyleVariant {
72     Variant1,
73     Variant2Changed(u32, f32),
74 }
75
76
77
78 // Change name of a struct-style variant --------------------------------------
79 #[cfg(any(cfail1,cfail4))]
80 enum EnumChangeNameStructStyleVariant {
81     Variant1,
82     Variant2 { a: u32, b: f32 },
83 }
84
85 #[cfg(not(any(cfail1,cfail4)))]
86 #[rustc_clean(cfg="cfail2", except="hir_owner,hir_owner_nodes,type_of")]
87 #[rustc_clean(cfg="cfail3")]
88 #[rustc_clean(cfg="cfail5", except="hir_owner,hir_owner_nodes,type_of")]
89 #[rustc_clean(cfg="cfail6")]
90 enum EnumChangeNameStructStyleVariant {
91     Variant1,
92     Variant2Changed { a: u32, b: f32 },
93 }
94
95
96
97 // Change the value of a c-style variant --------------------------------------
98 #[cfg(any(cfail1,cfail4))]
99 enum EnumChangeValueCStyleVariant0 {
100     Variant1,
101     Variant2 = 11,
102 }
103
104 #[cfg(not(any(cfail1,cfail4)))]
105 #[rustc_clean(cfg="cfail2", except="hir_owner_nodes")]
106 #[rustc_clean(cfg="cfail3")]
107 #[rustc_clean(cfg="cfail5", except="hir_owner_nodes")]
108 #[rustc_clean(cfg="cfail6")]
109 enum EnumChangeValueCStyleVariant0 {
110     Variant1,
111     Variant2 = 22,
112 }
113
114 #[cfg(any(cfail1,cfail4))]
115 enum EnumChangeValueCStyleVariant1 {
116     Variant1,
117     Variant2,
118 }
119
120 #[cfg(not(any(cfail1,cfail4)))]
121 #[rustc_clean(cfg="cfail2", except="hir_owner,hir_owner_nodes,type_of")]
122 #[rustc_clean(cfg="cfail3")]
123 #[rustc_clean(cfg="cfail5", except="hir_owner,hir_owner_nodes,type_of")]
124 #[rustc_clean(cfg="cfail6")]
125 enum EnumChangeValueCStyleVariant1 {
126     Variant1,
127     Variant2 = 11,
128 }
129
130
131
132 // Add a c-style variant ------------------------------------------------------
133 #[cfg(any(cfail1,cfail4))]
134 enum EnumAddCStyleVariant {
135     Variant1,
136 }
137
138 #[cfg(not(any(cfail1,cfail4)))]
139 #[rustc_clean(cfg="cfail2", except="hir_owner,hir_owner_nodes,type_of")]
140 #[rustc_clean(cfg="cfail3")]
141 #[rustc_clean(cfg="cfail5", except="hir_owner,hir_owner_nodes,type_of")]
142 #[rustc_clean(cfg="cfail6")]
143 enum EnumAddCStyleVariant {
144     Variant1,
145     Variant2,
146 }
147
148
149
150 // Remove a c-style variant ---------------------------------------------------
151 #[cfg(any(cfail1,cfail4))]
152 enum EnumRemoveCStyleVariant {
153     Variant1,
154     Variant2,
155 }
156
157 #[cfg(not(any(cfail1,cfail4)))]
158 #[rustc_clean(cfg="cfail2", except="hir_owner,hir_owner_nodes,type_of")]
159 #[rustc_clean(cfg="cfail3")]
160 #[rustc_clean(cfg="cfail5", except="hir_owner,hir_owner_nodes,type_of")]
161 #[rustc_clean(cfg="cfail6")]
162 enum EnumRemoveCStyleVariant {
163     Variant1,
164 }
165
166
167
168 // Add a tuple-style variant --------------------------------------------------
169 #[cfg(any(cfail1,cfail4))]
170 enum EnumAddTupleStyleVariant {
171     Variant1,
172 }
173
174 #[cfg(not(any(cfail1,cfail4)))]
175 #[rustc_clean(cfg="cfail2", except="hir_owner,hir_owner_nodes,type_of")]
176 #[rustc_clean(cfg="cfail3")]
177 #[rustc_clean(cfg="cfail5", except="hir_owner,hir_owner_nodes,type_of")]
178 #[rustc_clean(cfg="cfail6")]
179 enum EnumAddTupleStyleVariant {
180     Variant1,
181     Variant2(u32, f32),
182 }
183
184
185
186 // Remove a tuple-style variant -----------------------------------------------
187 #[cfg(any(cfail1,cfail4))]
188 enum EnumRemoveTupleStyleVariant {
189     Variant1,
190     Variant2(u32, f32),
191 }
192
193 #[cfg(not(any(cfail1,cfail4)))]
194 #[rustc_clean(cfg="cfail2", except="hir_owner,hir_owner_nodes,type_of")]
195 #[rustc_clean(cfg="cfail3")]
196 #[rustc_clean(cfg="cfail5", except="hir_owner,hir_owner_nodes,type_of")]
197 #[rustc_clean(cfg="cfail6")]
198 enum EnumRemoveTupleStyleVariant {
199     Variant1,
200 }
201
202
203
204 // Add a struct-style variant -------------------------------------------------
205 #[cfg(any(cfail1,cfail4))]
206 enum EnumAddStructStyleVariant {
207     Variant1,
208 }
209
210 #[cfg(not(any(cfail1,cfail4)))]
211 #[rustc_clean(cfg="cfail2", except="hir_owner,hir_owner_nodes,type_of")]
212 #[rustc_clean(cfg="cfail3")]
213 #[rustc_clean(cfg="cfail5", except="hir_owner,hir_owner_nodes,type_of")]
214 #[rustc_clean(cfg="cfail6")]
215 enum EnumAddStructStyleVariant {
216     Variant1,
217     Variant2 { a: u32, b: f32 },
218 }
219
220
221
222 // Remove a struct-style variant ----------------------------------------------
223 #[cfg(any(cfail1,cfail4))]
224 enum EnumRemoveStructStyleVariant {
225     Variant1,
226     Variant2 { a: u32, b: f32 },
227 }
228
229 #[cfg(not(any(cfail1,cfail4)))]
230 #[rustc_clean(cfg="cfail2", except="hir_owner,hir_owner_nodes,type_of")]
231 #[rustc_clean(cfg="cfail3")]
232 #[rustc_clean(cfg="cfail5", except="hir_owner,hir_owner_nodes,type_of")]
233 #[rustc_clean(cfg="cfail6")]
234 enum EnumRemoveStructStyleVariant {
235     Variant1,
236 }
237
238
239
240 // Change the type of a field in a tuple-style variant ------------------------
241 #[cfg(any(cfail1,cfail4))]
242 enum EnumChangeFieldTypeTupleStyleVariant {
243     Variant1(u32, u32),
244 }
245
246 #[cfg(not(any(cfail1,cfail4)))]
247 #[rustc_clean(cfg="cfail2", except="hir_owner,hir_owner_nodes")]
248 #[rustc_clean(cfg="cfail3")]
249 #[rustc_clean(cfg="cfail5", except="hir_owner,hir_owner_nodes")]
250 #[rustc_clean(cfg="cfail6")]
251 enum EnumChangeFieldTypeTupleStyleVariant {
252     Variant1(u32,
253         u64),
254 }
255
256
257
258 // Change the type of a field in a struct-style variant -----------------------
259 #[cfg(any(cfail1,cfail4))]
260 enum EnumChangeFieldTypeStructStyleVariant {
261     Variant1,
262     Variant2 { a: u32, b: u32 },
263 }
264
265 #[cfg(not(any(cfail1,cfail4)))]
266 #[rustc_clean(cfg="cfail2", except="hir_owner,hir_owner_nodes")]
267 #[rustc_clean(cfg="cfail3")]
268 #[rustc_clean(cfg="cfail5", except="hir_owner,hir_owner_nodes")]
269 #[rustc_clean(cfg="cfail6")]
270 enum EnumChangeFieldTypeStructStyleVariant {
271     Variant1,
272     Variant2 {
273         a: u32,
274         b: u64
275     },
276 }
277
278
279
280 // Change the name of a field in a struct-style variant -----------------------
281 #[cfg(any(cfail1,cfail4))]
282 enum EnumChangeFieldNameStructStyleVariant {
283     Variant1 { a: u32, b: u32 },
284 }
285
286 #[cfg(not(any(cfail1,cfail4)))]
287 #[rustc_clean(cfg="cfail2", except="hir_owner,hir_owner_nodes,type_of")]
288 #[rustc_clean(cfg="cfail3")]
289 #[rustc_clean(cfg="cfail5", except="hir_owner,hir_owner_nodes,type_of")]
290 #[rustc_clean(cfg="cfail6")]
291 enum EnumChangeFieldNameStructStyleVariant {
292     Variant1 { a: u32, c: u32 },
293 }
294
295
296
297 // Change order of fields in a tuple-style variant ----------------------------
298 #[cfg(any(cfail1,cfail4))]
299 enum EnumChangeOrderTupleStyleVariant {
300     Variant1(u32, u64),
301 }
302
303 #[cfg(not(any(cfail1,cfail4)))]
304 #[rustc_clean(cfg="cfail2", except="hir_owner,hir_owner_nodes")]
305 #[rustc_clean(cfg="cfail3")]
306 #[rustc_clean(cfg="cfail5", except="hir_owner,hir_owner_nodes")]
307 #[rustc_clean(cfg="cfail6")]
308 enum EnumChangeOrderTupleStyleVariant {
309     Variant1(
310         u64,
311         u32),
312 }
313
314
315
316 // Change order of fields in a struct-style variant ---------------------------
317 #[cfg(any(cfail1,cfail4))]
318 enum EnumChangeFieldOrderStructStyleVariant {
319     Variant1 { a: u32, b: f32 },
320 }
321
322 #[cfg(not(any(cfail1,cfail4)))]
323 #[rustc_clean(cfg="cfail2", except="hir_owner,hir_owner_nodes,type_of")]
324 #[rustc_clean(cfg="cfail3")]
325 #[rustc_clean(cfg="cfail5", except="hir_owner,hir_owner_nodes,type_of")]
326 #[rustc_clean(cfg="cfail6")]
327 enum EnumChangeFieldOrderStructStyleVariant {
328     Variant1 { b: f32, a: u32 },
329 }
330
331
332
333 // Add a field to a tuple-style variant ---------------------------------------
334 #[cfg(any(cfail1,cfail4))]
335 enum EnumAddFieldTupleStyleVariant {
336     Variant1(u32, u32),
337 }
338
339 #[cfg(not(any(cfail1,cfail4)))]
340 #[rustc_clean(cfg="cfail2", except="hir_owner,hir_owner_nodes,type_of")]
341 #[rustc_clean(cfg="cfail3")]
342 #[rustc_clean(cfg="cfail5", except="hir_owner,hir_owner_nodes,type_of")]
343 #[rustc_clean(cfg="cfail6")]
344 enum EnumAddFieldTupleStyleVariant {
345     Variant1(u32, u32, u32),
346 }
347
348
349
350 // Add a field to a struct-style variant --------------------------------------
351 #[cfg(any(cfail1,cfail4))]
352 enum EnumAddFieldStructStyleVariant {
353     Variant1 { a: u32, b: u32 },
354 }
355
356 #[cfg(not(any(cfail1,cfail4)))]
357 #[rustc_clean(cfg="cfail2", except="hir_owner,hir_owner_nodes,type_of")]
358 #[rustc_clean(cfg="cfail3")]
359 #[rustc_clean(cfg="cfail5", except="hir_owner,hir_owner_nodes,type_of")]
360 #[rustc_clean(cfg="cfail6")]
361 enum EnumAddFieldStructStyleVariant {
362     Variant1 { a: u32, b: u32, c: u32 },
363 }
364
365
366
367 // Add #[must_use] to the enum ------------------------------------------------
368 #[cfg(any(cfail1,cfail4))]
369 enum EnumAddMustUse {
370     Variant1,
371     Variant2,
372 }
373
374 #[cfg(not(any(cfail1,cfail4)))]
375 #[rustc_clean(cfg="cfail2")]
376 #[rustc_clean(cfg="cfail3")]
377 #[rustc_clean(cfg="cfail5")]
378 #[rustc_clean(cfg="cfail6")]
379 #[must_use]
380 enum EnumAddMustUse {
381     Variant1,
382     Variant2,
383 }
384
385
386
387 // Add #[repr(C)] to the enum -------------------------------------------------
388 #[cfg(any(cfail1,cfail4))]
389 enum EnumAddReprC {
390     Variant1,
391     Variant2,
392 }
393
394 #[cfg(not(any(cfail1,cfail4)))]
395 #[rustc_clean(cfg="cfail2", except="type_of")]
396 #[rustc_clean(cfg="cfail3")]
397 #[rustc_clean(cfg="cfail5", except="type_of")]
398 #[rustc_clean(cfg="cfail6")]
399 #[repr(C)]
400 enum EnumAddReprC {
401     Variant1,
402     Variant2,
403 }
404
405
406
407 // Change the name of a type parameter ----------------------------------------
408 #[cfg(any(cfail1,cfail4))]
409 enum EnumChangeNameOfTypeParameter<S> {
410     Variant1(S),
411 }
412
413 #[cfg(not(any(cfail1,cfail4)))]
414 #[rustc_clean(cfg="cfail2", except="hir_owner,hir_owner_nodes,generics_of,predicates_of,type_of")]
415 #[rustc_clean(cfg="cfail3")]
416 #[rustc_clean(cfg="cfail5", except="hir_owner,hir_owner_nodes,generics_of,predicates_of,type_of")]
417 #[rustc_clean(cfg="cfail6")]
418 enum EnumChangeNameOfTypeParameter<T> {
419     Variant1(T),
420 }
421
422
423
424 // Add a type parameter ------------------------------------------------------
425 #[cfg(any(cfail1,cfail4))]
426 enum EnumAddTypeParameter<S> {
427     Variant1(S),
428     Variant2(S),
429 }
430
431 #[cfg(not(any(cfail1,cfail4)))]
432 #[rustc_clean(cfg="cfail2", except="hir_owner,hir_owner_nodes,generics_of,predicates_of,type_of")]
433 #[rustc_clean(cfg="cfail3")]
434 #[rustc_clean(cfg="cfail5", except="hir_owner,hir_owner_nodes,generics_of,predicates_of,type_of")]
435 #[rustc_clean(cfg="cfail6")]
436 enum EnumAddTypeParameter<S, T> {
437     Variant1(S),
438     Variant2(T),
439 }
440
441
442
443 // Change the name of a lifetime parameter ------------------------------------
444 #[cfg(any(cfail1,cfail4))]
445 enum EnumChangeNameOfLifetimeParameter<'a> {
446     Variant1(&'a u32),
447 }
448
449 #[cfg(not(any(cfail1,cfail4)))]
450 #[rustc_clean(cfg="cfail2", except="hir_owner,hir_owner_nodes,generics_of,type_of")]
451 #[rustc_clean(cfg="cfail3")]
452 #[rustc_clean(cfg="cfail5", except="hir_owner,hir_owner_nodes,generics_of,type_of")]
453 #[rustc_clean(cfg="cfail6")]
454 enum EnumChangeNameOfLifetimeParameter<'b> {
455     Variant1(&'b u32),
456 }
457
458
459
460 // Add a lifetime parameter ---------------------------------------------------
461 #[cfg(any(cfail1,cfail4))]
462 enum EnumAddLifetimeParameter<'a> {
463     Variant1(&'a u32),
464     Variant2(&'a u32),
465 }
466
467 #[cfg(not(any(cfail1,cfail4)))]
468 #[rustc_clean(cfg="cfail2", except="hir_owner,hir_owner_nodes,generics_of,type_of")]
469 #[rustc_clean(cfg="cfail3")]
470 #[rustc_clean(cfg="cfail5", except="hir_owner,hir_owner_nodes,generics_of,type_of")]
471 #[rustc_clean(cfg="cfail6")]
472 enum EnumAddLifetimeParameter<'a, 'b> {
473     Variant1(&'a u32),
474     Variant2(&'b u32),
475 }
476
477
478
479 // Add a lifetime bound to a lifetime parameter -------------------------------
480 #[cfg(any(cfail1,cfail4))]
481 enum EnumAddLifetimeParameterBound<'a, 'b> {
482     Variant1(&'a u32),
483     Variant2(&'b u32),
484 }
485
486 #[cfg(not(any(cfail1,cfail4)))]
487 #[rustc_clean(cfg="cfail2", except="hir_owner,hir_owner_nodes,predicates_of")]
488 #[rustc_clean(cfg="cfail3")]
489 #[rustc_clean(cfg="cfail5", except="hir_owner,hir_owner_nodes,predicates_of")]
490 #[rustc_clean(cfg="cfail6")]
491 enum EnumAddLifetimeParameterBound<'a, 'b: 'a> {
492     Variant1(&'a u32),
493     Variant2(&'b u32),
494 }
495
496 // Add a lifetime bound to a type parameter -----------------------------------
497 #[cfg(any(cfail1,cfail4))]
498 enum EnumAddLifetimeBoundToParameter<'a, T> {
499     Variant1(T),
500     Variant2(&'a u32),
501 }
502
503 #[cfg(not(any(cfail1,cfail4)))]
504 #[rustc_clean(cfg="cfail2", except="hir_owner,hir_owner_nodes,predicates_of")]
505 #[rustc_clean(cfg="cfail3")]
506 #[rustc_clean(cfg="cfail5", except="hir_owner,hir_owner_nodes,predicates_of")]
507 #[rustc_clean(cfg="cfail6")]
508 enum EnumAddLifetimeBoundToParameter<'a, T: 'a> {
509     Variant1(T),
510     Variant2(&'a u32),
511 }
512
513
514
515 // Add a trait bound to a type parameter --------------------------------------
516 #[cfg(any(cfail1,cfail4))]
517 enum EnumAddTraitBound<S> {
518     Variant1(S),
519 }
520
521 #[cfg(not(any(cfail1,cfail4)))]
522 #[rustc_clean(cfg="cfail2", except="hir_owner,hir_owner_nodes,generics_of,predicates_of,type_of")]
523 #[rustc_clean(cfg="cfail3")]
524 #[rustc_clean(cfg="cfail5", except="hir_owner,hir_owner_nodes,generics_of,predicates_of,type_of")]
525 #[rustc_clean(cfg="cfail6")]
526 enum EnumAddTraitBound<T: Sync> {
527     Variant1(T),
528 }
529
530
531
532 // Add a lifetime bound to a lifetime parameter in where clause ---------------
533 #[cfg(any(cfail1,cfail4))]
534 enum EnumAddLifetimeParameterBoundWhere<'a, 'b> {
535     Variant1(&'a u32),
536     Variant2(&'b u32),
537 }
538
539 #[cfg(not(any(cfail1,cfail4)))]
540 #[rustc_clean(cfg="cfail2", except="hir_owner,hir_owner_nodes,predicates_of")]
541 #[rustc_clean(cfg="cfail3")]
542 #[rustc_clean(cfg="cfail5", except="hir_owner,hir_owner_nodes,predicates_of")]
543 #[rustc_clean(cfg="cfail6")]
544 enum EnumAddLifetimeParameterBoundWhere<'a, 'b> where 'b: 'a {
545     Variant1(&'a u32),
546     Variant2(&'b u32),
547 }
548
549
550
551 // Add a lifetime bound to a type parameter in where clause -------------------
552 #[cfg(any(cfail1,cfail4))]
553 enum EnumAddLifetimeBoundToParameterWhere<'a, T> {
554     Variant1(T),
555     Variant2(&'a u32),
556 }
557
558 #[cfg(not(any(cfail1,cfail4)))]
559 #[rustc_clean(cfg="cfail2", except="hir_owner,hir_owner_nodes,predicates_of")]
560 #[rustc_clean(cfg="cfail3")]
561 #[rustc_clean(cfg="cfail5", except="hir_owner,hir_owner_nodes,predicates_of")]
562 #[rustc_clean(cfg="cfail6")]
563 enum EnumAddLifetimeBoundToParameterWhere<'a, T> where T: 'a {
564     Variant1(T),
565     Variant2(&'a u32),
566 }
567
568
569
570 // Add a trait bound to a type parameter in where clause ----------------------
571 #[cfg(any(cfail1,cfail4))]
572 enum EnumAddTraitBoundWhere<S> {
573     Variant1(S),
574 }
575
576 #[cfg(not(any(cfail1,cfail4)))]
577 #[rustc_clean(cfg="cfail2", except="hir_owner,hir_owner_nodes,generics_of,predicates_of,type_of")]
578 #[rustc_clean(cfg="cfail3")]
579 #[rustc_clean(cfg="cfail5", except="hir_owner,hir_owner_nodes,generics_of,predicates_of,type_of")]
580 #[rustc_clean(cfg="cfail6")]
581 enum EnumAddTraitBoundWhere<T> where T: Sync {
582     Variant1(T),
583 }
584
585
586
587 // In an enum with two variants, swap usage of type parameters ----------------
588 #[cfg(any(cfail1,cfail4))]
589 enum EnumSwapUsageTypeParameters<A, B> {
590     Variant1 { a: A },
591     Variant2 { a: B },
592 }
593
594 #[cfg(not(any(cfail1,cfail4)))]
595 #[rustc_clean(cfg="cfail2", except="hir_owner,hir_owner_nodes")]
596 #[rustc_clean(cfg="cfail3")]
597 #[rustc_clean(cfg="cfail5", except="hir_owner,hir_owner_nodes")]
598 #[rustc_clean(cfg="cfail6")]
599 enum EnumSwapUsageTypeParameters<A, B> {
600     Variant1 {
601         a: B
602     },
603     Variant2 {
604         a: A
605     },
606 }
607
608
609
610 // In an enum with two variants, swap usage of lifetime parameters ------------
611 #[cfg(any(cfail1,cfail4))]
612 enum EnumSwapUsageLifetimeParameters<'a, 'b> {
613     Variant1 { a: &'a u32 },
614     Variant2 { b: &'b u32 },
615 }
616
617 #[cfg(not(any(cfail1,cfail4)))]
618 #[rustc_clean(cfg="cfail2", except="hir_owner,hir_owner_nodes")]
619 #[rustc_clean(cfg="cfail3")]
620 #[rustc_clean(cfg="cfail5", except="hir_owner,hir_owner_nodes")]
621 #[rustc_clean(cfg="cfail6")]
622 enum EnumSwapUsageLifetimeParameters<'a, 'b> {
623     Variant1 {
624         a: &'b u32
625     },
626     Variant2 {
627         b: &'a u32
628     },
629 }
630
631
632
633 struct ReferencedType1;
634 struct ReferencedType2;
635
636
637
638 // Change field type in tuple-style variant indirectly by modifying a use statement
639 mod change_field_type_indirectly_tuple_style {
640     #[cfg(any(cfail1,cfail4))]
641     use super::ReferencedType1 as FieldType;
642     #[cfg(not(any(cfail1,cfail4)))]
643     use super::ReferencedType2 as FieldType;
644
645     #[rustc_clean(cfg="cfail2", except="hir_owner,hir_owner_nodes")]
646     #[rustc_clean(cfg="cfail3")]
647     #[rustc_clean(cfg="cfail5", except="hir_owner,hir_owner_nodes")]
648     #[rustc_clean(cfg="cfail6")]
649     enum TupleStyle {
650         Variant1(
651             FieldType
652         )
653     }
654 }
655
656
657
658 // Change field type in record-style variant indirectly by modifying a use statement
659 mod change_field_type_indirectly_struct_style {
660     #[cfg(any(cfail1,cfail4))]
661     use super::ReferencedType1 as FieldType;
662     #[cfg(not(any(cfail1,cfail4)))]
663     use super::ReferencedType2 as FieldType;
664
665     #[rustc_clean(cfg="cfail2", except="hir_owner,hir_owner_nodes")]
666     #[rustc_clean(cfg="cfail3")]
667     #[rustc_clean(cfg="cfail5", except="hir_owner,hir_owner_nodes")]
668     #[rustc_clean(cfg="cfail6")]
669     enum StructStyle {
670         Variant1 {
671             a: FieldType
672         }
673     }
674 }
675
676
677
678 trait ReferencedTrait1 {}
679 trait ReferencedTrait2 {}
680
681
682
683 // Change trait bound of type parameter indirectly by modifying a use statement
684 mod change_trait_bound_indirectly {
685     #[cfg(any(cfail1,cfail4))]
686     use super::ReferencedTrait1 as Trait;
687     #[cfg(not(any(cfail1,cfail4)))]
688     use super::ReferencedTrait2 as Trait;
689
690     #[rustc_clean(cfg="cfail2", except="hir_owner,hir_owner_nodes,predicates_of")]
691     #[rustc_clean(cfg="cfail3")]
692     #[rustc_clean(cfg="cfail5", except="hir_owner,hir_owner_nodes,predicates_of")]
693     #[rustc_clean(cfg="cfail6")]
694     enum Enum<T: Trait> {
695         Variant1(T)
696     }
697 }
698
699
700
701 // Change trait bound of type parameter in where clause indirectly by modifying a use statement
702 mod change_trait_bound_indirectly_where {
703     #[cfg(any(cfail1,cfail4))]
704     use super::ReferencedTrait1 as Trait;
705     #[cfg(not(any(cfail1,cfail4)))]
706     use super::ReferencedTrait2 as Trait;
707
708     #[rustc_clean(cfg="cfail2", except="hir_owner,hir_owner_nodes,predicates_of")]
709     #[rustc_clean(cfg="cfail3")]
710     #[rustc_clean(cfg="cfail5", except="hir_owner,hir_owner_nodes,predicates_of")]
711     #[rustc_clean(cfg="cfail6")]
712     enum Enum<T> where T: Trait {
713         Variant1(T)
714     }
715 }