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