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