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