]> git.lizzy.rs Git - rust.git/blob - src/test/incremental/hashes/trait_defs.rs
Auto merge of #70211 - Centril:rollup-fusltgc, r=Centril
[rust.git] / src / test / incremental / hashes / trait_defs.rs
1 // This test case tests the incremental compilation hash (ICH) implementation
2 // for trait 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 trait 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 trait'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
15 // compile-flags: -Z query-dep-graph -Zincremental-ignore-spans
16
17 #![allow(warnings)]
18 #![feature(rustc_attrs)]
19 #![crate_type="rlib"]
20 #![feature(associated_type_defaults)]
21
22
23 // Change trait visibility
24 #[cfg(cfail1)]
25 trait TraitVisibility { }
26
27 #[cfg(not(cfail1))]
28 #[rustc_dirty(label="hir_owner", cfg="cfail2")]
29 #[rustc_clean(label="hir_owner", cfg="cfail3")]
30 pub trait TraitVisibility { }
31
32
33
34 // Change trait unsafety
35 #[cfg(cfail1)]
36 trait TraitUnsafety { }
37
38 #[cfg(not(cfail1))]
39 #[rustc_dirty(label="hir_owner", cfg="cfail2")]
40 #[rustc_clean(label="hir_owner", cfg="cfail3")]
41 unsafe trait TraitUnsafety { }
42
43
44
45 // Add method
46 #[cfg(cfail1)]
47 trait TraitAddMethod {
48 }
49
50 #[cfg(not(cfail1))]
51 #[rustc_dirty(label="hir_owner", cfg="cfail2")]
52 #[rustc_clean(label="hir_owner", cfg="cfail3")]
53 pub trait TraitAddMethod {
54     fn method();
55 }
56
57
58
59 // Change name of method
60 #[cfg(cfail1)]
61 trait TraitChangeMethodName {
62     fn method();
63 }
64
65 #[cfg(not(cfail1))]
66 #[rustc_dirty(label="hir_owner", cfg="cfail2")]
67 #[rustc_clean(label="hir_owner", cfg="cfail3")]
68 trait TraitChangeMethodName {
69     fn methodChanged();
70 }
71
72
73
74 // Add return type to method
75 #[cfg(cfail1)]
76 trait TraitAddReturnType {
77     fn method();
78 }
79
80 #[cfg(not(cfail1))]
81 #[rustc_clean(label="hir_owner", cfg="cfail2")]
82 #[rustc_clean(label="hir_owner", cfg="cfail3")]
83 trait TraitAddReturnType {
84     #[rustc_dirty(label="hir_owner", cfg="cfail2")]
85     #[rustc_clean(label="hir_owner", cfg="cfail3")]
86     fn method() -> u32;
87 }
88
89
90
91 // Change return type of method
92 #[cfg(cfail1)]
93 trait TraitChangeReturnType {
94     fn method() -> u32;
95 }
96
97 #[cfg(not(cfail1))]
98 #[rustc_clean(label="hir_owner", cfg="cfail2")]
99 #[rustc_clean(label="hir_owner", cfg="cfail3")]
100 trait TraitChangeReturnType {
101     #[rustc_dirty(label="hir_owner", cfg="cfail2")]
102     #[rustc_clean(label="hir_owner", cfg="cfail3")]
103     fn method() -> u64;
104 }
105
106
107
108 // Add parameter to method
109 #[cfg(cfail1)]
110 trait TraitAddParameterToMethod {
111     fn method();
112 }
113
114 #[cfg(not(cfail1))]
115 #[rustc_clean(label="hir_owner", cfg="cfail2")]
116 #[rustc_clean(label="hir_owner", cfg="cfail3")]
117 trait TraitAddParameterToMethod {
118     #[rustc_dirty(label="hir_owner", cfg="cfail2")]
119     #[rustc_clean(label="hir_owner", cfg="cfail3")]
120     fn method(a: u32);
121 }
122
123
124
125 // Change name of method parameter
126 #[cfg(cfail1)]
127 trait TraitChangeMethodParameterName {
128     fn method(a: u32);
129     fn with_default(x: i32) {}
130 }
131
132 #[cfg(not(cfail1))]
133 #[rustc_clean(label="hir_owner", cfg="cfail2")]
134 #[rustc_clean(label="hir_owner", cfg="cfail3")]
135 trait TraitChangeMethodParameterName {
136     // FIXME(#38501) This should preferably always be clean.
137     #[rustc_dirty(label="hir_owner", cfg="cfail2")]
138     #[rustc_clean(label="hir_owner", cfg="cfail3")]
139     fn method(b: u32);
140
141     #[rustc_clean(label="hir_owner", cfg="cfail2")]
142     #[rustc_clean(label="hir_owner", cfg="cfail3")]
143     #[rustc_dirty(label="hir_owner_nodes", cfg="cfail2")]
144     #[rustc_clean(label="hir_owner_nodes", cfg="cfail3")]
145     fn with_default(y: i32) {}
146 }
147
148
149
150 // Change type of method parameter (i32 => i64)
151 #[cfg(cfail1)]
152 trait TraitChangeMethodParameterType {
153     fn method(a: i32);
154 }
155
156 #[cfg(not(cfail1))]
157 #[rustc_clean(label="hir_owner", cfg="cfail2")]
158 #[rustc_clean(label="hir_owner", cfg="cfail3")]
159 trait TraitChangeMethodParameterType {
160     #[rustc_dirty(label="hir_owner", cfg="cfail2")]
161     #[rustc_clean(label="hir_owner", cfg="cfail3")]
162     fn method(a: i64);
163 }
164
165
166
167 // Change type of method parameter (&i32 => &mut i32)
168 #[cfg(cfail1)]
169 trait TraitChangeMethodParameterTypeRef {
170     fn method(a: &i32);
171 }
172
173 #[cfg(not(cfail1))]
174 #[rustc_clean(label="hir_owner", cfg="cfail2")]
175 #[rustc_clean(label="hir_owner", cfg="cfail3")]
176 trait TraitChangeMethodParameterTypeRef {
177     #[rustc_dirty(label="hir_owner", cfg="cfail2")]
178     #[rustc_clean(label="hir_owner", cfg="cfail3")]
179     fn method(a: &mut i32);
180 }
181
182
183
184 // Change order of method parameters
185 #[cfg(cfail1)]
186 trait TraitChangeMethodParametersOrder {
187     fn method(a: i32, b: i64);
188 }
189
190 #[cfg(not(cfail1))]
191 #[rustc_clean(label="hir_owner", cfg="cfail2")]
192 #[rustc_clean(label="hir_owner", cfg="cfail3")]
193 trait TraitChangeMethodParametersOrder {
194     #[rustc_dirty(label="hir_owner", cfg="cfail2")]
195     #[rustc_clean(label="hir_owner", cfg="cfail3")]
196     fn method(b: i64, a: i32);
197 }
198
199
200
201 // Add default implementation to method
202 #[cfg(cfail1)]
203 trait TraitAddMethodAutoImplementation {
204     fn method();
205 }
206
207 #[cfg(not(cfail1))]
208 #[rustc_dirty(label="hir_owner", cfg="cfail2")]
209 #[rustc_clean(label="hir_owner", cfg="cfail3")]
210 trait TraitAddMethodAutoImplementation {
211     #[rustc_dirty(label="hir_owner", cfg="cfail2")]
212     #[rustc_clean(label="hir_owner", cfg="cfail3")]
213     fn method() { }
214 }
215
216
217
218 // Change order of methods
219 #[cfg(cfail1)]
220 trait TraitChangeOrderOfMethods {
221     fn method0();
222     fn method1();
223 }
224
225 #[cfg(not(cfail1))]
226 #[rustc_dirty(label="hir_owner", cfg="cfail2")]
227 #[rustc_clean(label="hir_owner", cfg="cfail3")]
228 trait TraitChangeOrderOfMethods {
229     fn method1();
230     fn method0();
231 }
232
233
234
235 // Change mode of self parameter
236 #[cfg(cfail1)]
237 trait TraitChangeModeSelfRefToMut {
238     fn method(&self);
239 }
240
241 #[cfg(not(cfail1))]
242 #[rustc_clean(label="hir_owner", cfg="cfail2")]
243 #[rustc_clean(label="hir_owner", cfg="cfail3")]
244 trait TraitChangeModeSelfRefToMut {
245     #[rustc_dirty(label="hir_owner", cfg="cfail2")]
246     #[rustc_clean(label="hir_owner", cfg="cfail3")]
247     fn method(&mut self);
248 }
249
250
251
252 #[cfg(cfail1)]
253 trait TraitChangeModeSelfOwnToMut: Sized {
254     fn method(self) {}
255 }
256
257 #[cfg(not(cfail1))]
258 #[rustc_clean(label="hir_owner", cfg="cfail2")]
259 #[rustc_clean(label="hir_owner", cfg="cfail3")]
260 trait TraitChangeModeSelfOwnToMut: Sized {
261     #[rustc_dirty(label="hir_owner", cfg="cfail2")]
262     #[rustc_clean(label="hir_owner", cfg="cfail3")]
263     #[rustc_dirty(label="hir_owner_nodes", cfg="cfail2")]
264     #[rustc_clean(label="hir_owner_nodes", cfg="cfail3")]
265     fn method(mut self) {}
266 }
267
268
269
270 #[cfg(cfail1)]
271 trait TraitChangeModeSelfOwnToRef {
272     fn method(self);
273 }
274
275 #[cfg(not(cfail1))]
276 #[rustc_clean(label="hir_owner", cfg="cfail2")]
277 #[rustc_clean(label="hir_owner", cfg="cfail3")]
278 trait TraitChangeModeSelfOwnToRef {
279     #[rustc_dirty(label="hir_owner", cfg="cfail2")]
280     #[rustc_clean(label="hir_owner", cfg="cfail3")]
281     fn method(&self);
282 }
283
284
285
286 // Add unsafe modifier to method
287 #[cfg(cfail1)]
288 trait TraitAddUnsafeModifier {
289     fn method();
290 }
291
292 #[cfg(not(cfail1))]
293 #[rustc_clean(label="hir_owner", cfg="cfail2")]
294 #[rustc_clean(label="hir_owner", cfg="cfail3")]
295 trait TraitAddUnsafeModifier {
296     #[rustc_dirty(label="hir_owner", cfg="cfail2")]
297     #[rustc_clean(label="hir_owner", cfg="cfail3")]
298     unsafe fn method();
299 }
300
301
302
303 // Add extern modifier to method
304 #[cfg(cfail1)]
305 trait TraitAddExternModifier {
306     fn method();
307 }
308
309 #[cfg(not(cfail1))]
310 #[rustc_clean(label="hir_owner", cfg="cfail2")]
311 #[rustc_clean(label="hir_owner", cfg="cfail3")]
312 trait TraitAddExternModifier {
313     #[rustc_dirty(label="hir_owner", cfg="cfail2")]
314     #[rustc_clean(label="hir_owner", cfg="cfail3")]
315     extern fn method();
316 }
317
318
319
320 // Change extern "C" to extern "stdcall"
321 #[cfg(cfail1)]
322 trait TraitChangeExternCToRustIntrinsic {
323     extern "C" fn method();
324 }
325
326 #[cfg(not(cfail1))]
327 #[rustc_clean(label="hir_owner", cfg="cfail2")]
328 #[rustc_clean(label="hir_owner", cfg="cfail3")]
329 trait TraitChangeExternCToRustIntrinsic {
330     #[rustc_dirty(label="hir_owner", cfg="cfail2")]
331     #[rustc_clean(label="hir_owner", cfg="cfail3")]
332     extern "stdcall" fn method();
333 }
334
335
336
337 // Add type parameter to method
338 #[cfg(cfail1)]
339 trait TraitAddTypeParameterToMethod {
340     fn method();
341 }
342
343 #[cfg(not(cfail1))]
344 #[rustc_clean(label="hir_owner", cfg="cfail2")]
345 #[rustc_clean(label="hir_owner", cfg="cfail3")]
346 trait TraitAddTypeParameterToMethod {
347     #[rustc_dirty(label="hir_owner", cfg="cfail2")]
348     #[rustc_clean(label="hir_owner", cfg="cfail3")]
349     fn method<T>();
350 }
351
352
353
354 // Add lifetime parameter to method
355 #[cfg(cfail1)]
356 trait TraitAddLifetimeParameterToMethod {
357     fn method();
358 }
359
360 #[cfg(not(cfail1))]
361 #[rustc_clean(label="hir_owner", cfg="cfail2")]
362 #[rustc_clean(label="hir_owner", cfg="cfail3")]
363 trait TraitAddLifetimeParameterToMethod {
364     #[rustc_dirty(label="hir_owner", cfg="cfail2")]
365     #[rustc_clean(label="hir_owner", cfg="cfail3")]
366     fn method<'a>();
367 }
368
369
370
371 // dummy trait for bound
372 trait ReferencedTrait0 { }
373 trait ReferencedTrait1 { }
374
375 // Add trait bound to method type parameter
376 #[cfg(cfail1)]
377 trait TraitAddTraitBoundToMethodTypeParameter {
378     fn method<T>();
379 }
380
381 #[cfg(not(cfail1))]
382 #[rustc_clean(label="hir_owner", cfg="cfail2")]
383 #[rustc_clean(label="hir_owner", cfg="cfail3")]
384 trait TraitAddTraitBoundToMethodTypeParameter {
385     #[rustc_dirty(label="hir_owner", cfg="cfail2")]
386     #[rustc_clean(label="hir_owner", cfg="cfail3")]
387     fn method<T: ReferencedTrait0>();
388 }
389
390
391
392 // Add builtin bound to method type parameter
393 #[cfg(cfail1)]
394 trait TraitAddBuiltinBoundToMethodTypeParameter {
395     fn method<T>();
396 }
397
398 #[cfg(not(cfail1))]
399 #[rustc_clean(label="hir_owner", cfg="cfail2")]
400 #[rustc_clean(label="hir_owner", cfg="cfail3")]
401 trait TraitAddBuiltinBoundToMethodTypeParameter {
402     #[rustc_dirty(label="hir_owner", cfg="cfail2")]
403     #[rustc_clean(label="hir_owner", cfg="cfail3")]
404     fn method<T: Sized>();
405 }
406
407
408
409 // Add lifetime bound to method lifetime parameter
410 #[cfg(cfail1)]
411 trait TraitAddLifetimeBoundToMethodLifetimeParameter {
412     fn method<'a, 'b>(a: &'a u32, b: &'b u32);
413 }
414
415 #[cfg(not(cfail1))]
416 #[rustc_clean(label="hir_owner", cfg="cfail2")]
417 #[rustc_clean(label="hir_owner", cfg="cfail3")]
418 trait TraitAddLifetimeBoundToMethodLifetimeParameter {
419     #[rustc_dirty(label="hir_owner", cfg="cfail2")]
420     #[rustc_clean(label="hir_owner", cfg="cfail3")]
421     fn method<'a, 'b: 'a>(a: &'a u32, b: &'b u32);
422 }
423
424
425
426 // Add second trait bound to method type parameter
427 #[cfg(cfail1)]
428 trait TraitAddSecondTraitBoundToMethodTypeParameter {
429     fn method<T: ReferencedTrait0>();
430 }
431
432 #[cfg(not(cfail1))]
433 #[rustc_clean(label="hir_owner", cfg="cfail2")]
434 #[rustc_clean(label="hir_owner", cfg="cfail3")]
435 trait TraitAddSecondTraitBoundToMethodTypeParameter {
436     #[rustc_dirty(label="hir_owner", cfg="cfail2")]
437     #[rustc_clean(label="hir_owner", cfg="cfail3")]
438     fn method<T: ReferencedTrait0 + ReferencedTrait1>();
439 }
440
441
442
443 // Add second builtin bound to method type parameter
444 #[cfg(cfail1)]
445 trait TraitAddSecondBuiltinBoundToMethodTypeParameter {
446     fn method<T: Sized>();
447 }
448
449 #[cfg(not(cfail1))]
450 #[rustc_clean(label="hir_owner", cfg="cfail2")]
451 #[rustc_clean(label="hir_owner", cfg="cfail3")]
452 trait TraitAddSecondBuiltinBoundToMethodTypeParameter {
453     #[rustc_dirty(label="hir_owner", cfg="cfail2")]
454     #[rustc_clean(label="hir_owner", cfg="cfail3")]
455     fn method<T: Sized + Sync>();
456 }
457
458
459
460 // Add second lifetime bound to method lifetime parameter
461 #[cfg(cfail1)]
462 trait TraitAddSecondLifetimeBoundToMethodLifetimeParameter {
463     fn method<'a, 'b, 'c: 'a>(a: &'a u32, b: &'b u32, c: &'c u32);
464 }
465
466 #[cfg(not(cfail1))]
467 #[rustc_clean(label="hir_owner", cfg="cfail2")]
468 #[rustc_clean(label="hir_owner", cfg="cfail3")]
469 trait TraitAddSecondLifetimeBoundToMethodLifetimeParameter {
470     #[rustc_dirty(label="hir_owner", cfg="cfail2")]
471     #[rustc_clean(label="hir_owner", cfg="cfail3")]
472     fn method<'a, 'b, 'c: 'a + 'b>(a: &'a u32, b: &'b u32, c: &'c u32);
473 }
474
475
476
477 // Add associated type
478 #[cfg(cfail1)]
479 trait TraitAddAssociatedType {
480
481     #[rustc_dirty(label="hir_owner", cfg="cfail2")]
482     #[rustc_clean(label="hir_owner", cfg="cfail3")]
483     fn method();
484 }
485
486 #[cfg(not(cfail1))]
487 #[rustc_dirty(label="hir_owner", cfg="cfail2")]
488 #[rustc_clean(label="hir_owner", cfg="cfail3")]
489 trait TraitAddAssociatedType {
490     type Associated;
491
492     fn method();
493 }
494
495
496
497 // Add trait bound to associated type
498 #[cfg(cfail1)]
499 trait TraitAddTraitBoundToAssociatedType {
500     type Associated;
501
502     fn method();
503 }
504
505
506 // Apparently the type bound contributes to the predicates of the trait, but
507 // does not change the associated item itself.
508 #[cfg(not(cfail1))]
509 #[rustc_clean(label="hir_owner", cfg="cfail2")]
510 #[rustc_clean(label="hir_owner", cfg="cfail3")]
511 trait TraitAddTraitBoundToAssociatedType {
512     #[rustc_dirty(label="hir_owner", cfg="cfail2")]
513     #[rustc_clean(label="hir_owner", cfg="cfail3")]
514     type Associated: ReferencedTrait0;
515
516     fn method();
517 }
518
519
520
521 // Add lifetime bound to associated type
522 #[cfg(cfail1)]
523 trait TraitAddLifetimeBoundToAssociatedType<'a> {
524     type Associated;
525
526     fn method();
527 }
528
529 #[cfg(not(cfail1))]
530 #[rustc_clean(label="hir_owner", cfg="cfail2")]
531 #[rustc_clean(label="hir_owner", cfg="cfail3")]
532 trait TraitAddLifetimeBoundToAssociatedType<'a> {
533     #[rustc_dirty(label="hir_owner", cfg="cfail2")]
534     #[rustc_clean(label="hir_owner", cfg="cfail3")]
535     type Associated: 'a;
536
537     fn method();
538 }
539
540
541
542 // Add default to associated type
543 #[cfg(cfail1)]
544 trait TraitAddDefaultToAssociatedType {
545     type Associated;
546
547     fn method();
548 }
549
550 #[cfg(not(cfail1))]
551 #[rustc_dirty(label="hir_owner", cfg="cfail2")]
552 #[rustc_clean(label="hir_owner", cfg="cfail3")]
553 trait TraitAddDefaultToAssociatedType {
554     #[rustc_dirty(label="hir_owner", cfg="cfail2")]
555     #[rustc_clean(label="hir_owner", cfg="cfail3")]
556     type Associated = ReferenceType0;
557
558     fn method();
559 }
560
561
562
563 // Add associated constant
564 #[cfg(cfail1)]
565 trait TraitAddAssociatedConstant {
566     fn method();
567 }
568
569 #[cfg(not(cfail1))]
570 #[rustc_dirty(label="hir_owner", cfg="cfail2")]
571 #[rustc_clean(label="hir_owner", cfg="cfail3")]
572 trait TraitAddAssociatedConstant {
573     const Value: u32;
574
575     fn method();
576 }
577
578
579
580 // Add initializer to associated constant
581 #[cfg(cfail1)]
582 trait TraitAddInitializerToAssociatedConstant {
583     const Value: u32;
584
585     fn method();
586 }
587
588 #[cfg(not(cfail1))]
589 #[rustc_dirty(label="hir_owner", cfg="cfail2")]
590 #[rustc_clean(label="hir_owner", cfg="cfail3")]
591 trait TraitAddInitializerToAssociatedConstant {
592     #[rustc_dirty(label="hir_owner", cfg="cfail2")]
593     #[rustc_clean(label="hir_owner", cfg="cfail3")]
594     const Value: u32 = 1;
595
596     #[rustc_clean(label="hir_owner", cfg="cfail2")]
597     #[rustc_clean(label="hir_owner", cfg="cfail3")]
598     fn method();
599 }
600
601
602
603 // Change type of associated constant
604 #[cfg(cfail1)]
605 trait TraitChangeTypeOfAssociatedConstant {
606     const Value: u32;
607
608     fn method();
609 }
610
611 #[cfg(not(cfail1))]
612 #[rustc_clean(label="hir_owner", cfg="cfail2")]
613 #[rustc_clean(label="hir_owner", cfg="cfail3")]
614 trait TraitChangeTypeOfAssociatedConstant {
615     #[rustc_dirty(label="hir_owner", cfg="cfail2")]
616     #[rustc_clean(label="hir_owner", cfg="cfail3")]
617     const Value: f64;
618
619     #[rustc_clean(label="hir_owner", cfg="cfail2")]
620     #[rustc_clean(label="hir_owner", cfg="cfail3")]
621     fn method();
622 }
623
624
625
626 // Add super trait
627 #[cfg(cfail1)]
628 trait TraitAddSuperTrait { }
629
630 #[cfg(not(cfail1))]
631 #[rustc_dirty(label="hir_owner", cfg="cfail2")]
632 #[rustc_clean(label="hir_owner", cfg="cfail3")]
633 trait TraitAddSuperTrait : ReferencedTrait0 { }
634
635
636
637 // Add builtin bound (Send or Copy)
638 #[cfg(cfail1)]
639 trait TraitAddBuiltiBound { }
640
641 #[cfg(not(cfail1))]
642 #[rustc_dirty(label="hir_owner", cfg="cfail2")]
643 #[rustc_clean(label="hir_owner", cfg="cfail3")]
644 trait TraitAddBuiltiBound : Send { }
645
646
647
648 // Add 'static lifetime bound to trait
649 #[cfg(cfail1)]
650 trait TraitAddStaticLifetimeBound { }
651
652 #[cfg(not(cfail1))]
653 #[rustc_dirty(label="hir_owner", cfg="cfail2")]
654 #[rustc_clean(label="hir_owner", cfg="cfail3")]
655 trait TraitAddStaticLifetimeBound : 'static { }
656
657
658
659 // Add super trait as second bound
660 #[cfg(cfail1)]
661 trait TraitAddTraitAsSecondBound : ReferencedTrait0 { }
662
663 #[cfg(not(cfail1))]
664 #[rustc_dirty(label="hir_owner", cfg="cfail2")]
665 #[rustc_clean(label="hir_owner", cfg="cfail3")]
666 trait TraitAddTraitAsSecondBound : ReferencedTrait0 + ReferencedTrait1 { }
667
668 #[cfg(cfail1)]
669 trait TraitAddTraitAsSecondBoundFromBuiltin : Send { }
670
671 #[cfg(not(cfail1))]
672 #[rustc_dirty(label="hir_owner", cfg="cfail2")]
673 #[rustc_clean(label="hir_owner", cfg="cfail3")]
674 trait TraitAddTraitAsSecondBoundFromBuiltin : Send + ReferencedTrait0 { }
675
676
677
678 // Add builtin bound as second bound
679 #[cfg(cfail1)]
680 trait TraitAddBuiltinBoundAsSecondBound : ReferencedTrait0 { }
681
682 #[cfg(not(cfail1))]
683 #[rustc_dirty(label="hir_owner", cfg="cfail2")]
684 #[rustc_clean(label="hir_owner", cfg="cfail3")]
685 trait TraitAddBuiltinBoundAsSecondBound : ReferencedTrait0 + Send { }
686
687 #[cfg(cfail1)]
688 trait TraitAddBuiltinBoundAsSecondBoundFromBuiltin : Send { }
689
690 #[cfg(not(cfail1))]
691 #[rustc_dirty(label="hir_owner", cfg="cfail2")]
692 #[rustc_clean(label="hir_owner", cfg="cfail3")]
693 trait TraitAddBuiltinBoundAsSecondBoundFromBuiltin: Send + Copy { }
694
695
696
697 // Add 'static bounds as second bound
698 #[cfg(cfail1)]
699 trait TraitAddStaticBoundAsSecondBound : ReferencedTrait0 { }
700
701 #[cfg(not(cfail1))]
702 #[rustc_dirty(label="hir_owner", cfg="cfail2")]
703 #[rustc_clean(label="hir_owner", cfg="cfail3")]
704 trait TraitAddStaticBoundAsSecondBound : ReferencedTrait0 + 'static { }
705
706 #[cfg(cfail1)]
707 trait TraitAddStaticBoundAsSecondBoundFromBuiltin : Send { }
708
709 #[cfg(not(cfail1))]
710 #[rustc_dirty(label="hir_owner", cfg="cfail2")]
711 #[rustc_clean(label="hir_owner", cfg="cfail3")]
712 trait TraitAddStaticBoundAsSecondBoundFromBuiltin : Send + 'static { }
713
714
715
716 // Add type parameter to trait
717 #[cfg(cfail1)]
718 trait TraitAddTypeParameterToTrait { }
719
720 #[cfg(not(cfail1))]
721 #[rustc_dirty(label="hir_owner", cfg="cfail2")]
722 #[rustc_clean(label="hir_owner", cfg="cfail3")]
723 trait TraitAddTypeParameterToTrait<T> { }
724
725
726
727 // Add lifetime parameter to trait
728 #[cfg(cfail1)]
729 trait TraitAddLifetimeParameterToTrait { }
730
731 #[cfg(not(cfail1))]
732 #[rustc_dirty(label="hir_owner", cfg="cfail2")]
733 #[rustc_clean(label="hir_owner", cfg="cfail3")]
734 trait TraitAddLifetimeParameterToTrait<'a> { }
735
736
737
738 // Add trait bound to type parameter of trait
739 #[cfg(cfail1)]
740 trait TraitAddTraitBoundToTypeParameterOfTrait<T> { }
741
742 #[cfg(not(cfail1))]
743 #[rustc_dirty(label="hir_owner", cfg="cfail2")]
744 #[rustc_clean(label="hir_owner", cfg="cfail3")]
745 trait TraitAddTraitBoundToTypeParameterOfTrait<T: ReferencedTrait0> { }
746
747
748
749 // Add lifetime bound to type parameter of trait
750 #[cfg(cfail1)]
751 trait TraitAddLifetimeBoundToTypeParameterOfTrait<'a, T> { }
752
753 #[cfg(not(cfail1))]
754 #[rustc_dirty(label="hir_owner", cfg="cfail2")]
755 #[rustc_clean(label="hir_owner", cfg="cfail3")]
756 trait TraitAddLifetimeBoundToTypeParameterOfTrait<'a, T: 'a> { }
757
758
759
760 // Add lifetime bound to lifetime parameter of trait
761 #[cfg(cfail1)]
762 trait TraitAddLifetimeBoundToLifetimeParameterOfTrait<'a, 'b> { }
763
764 #[cfg(not(cfail1))]
765 #[rustc_dirty(label="hir_owner", cfg="cfail2")]
766 #[rustc_clean(label="hir_owner", cfg="cfail3")]
767 trait TraitAddLifetimeBoundToLifetimeParameterOfTrait<'a: 'b, 'b> { }
768
769
770
771 // Add builtin bound to type parameter of trait
772 #[cfg(cfail1)]
773 trait TraitAddBuiltinBoundToTypeParameterOfTrait<T> { }
774
775 #[cfg(not(cfail1))]
776 #[rustc_dirty(label="hir_owner", cfg="cfail2")]
777 #[rustc_clean(label="hir_owner", cfg="cfail3")]
778 trait TraitAddBuiltinBoundToTypeParameterOfTrait<T: Send> { }
779
780
781
782 // Add second type parameter to trait
783 #[cfg(cfail1)]
784 trait TraitAddSecondTypeParameterToTrait<T> { }
785
786 #[cfg(not(cfail1))]
787 #[rustc_dirty(label="hir_owner", cfg="cfail2")]
788 #[rustc_clean(label="hir_owner", cfg="cfail3")]
789 trait TraitAddSecondTypeParameterToTrait<T, S> { }
790
791
792
793 // Add second lifetime parameter to trait
794 #[cfg(cfail1)]
795 trait TraitAddSecondLifetimeParameterToTrait<'a> { }
796
797 #[cfg(not(cfail1))]
798 #[rustc_dirty(label="hir_owner", cfg="cfail2")]
799 #[rustc_clean(label="hir_owner", cfg="cfail3")]
800 trait TraitAddSecondLifetimeParameterToTrait<'a, 'b> { }
801
802
803
804 // Add second trait bound to type parameter of trait
805 #[cfg(cfail1)]
806 trait TraitAddSecondTraitBoundToTypeParameterOfTrait<T: ReferencedTrait0> { }
807
808 #[cfg(not(cfail1))]
809 #[rustc_dirty(label="hir_owner", cfg="cfail2")]
810 #[rustc_clean(label="hir_owner", cfg="cfail3")]
811 trait TraitAddSecondTraitBoundToTypeParameterOfTrait<T: ReferencedTrait0 + ReferencedTrait1> { }
812
813
814
815 // Add second lifetime bound to type parameter of trait
816 #[cfg(cfail1)]
817 trait TraitAddSecondLifetimeBoundToTypeParameterOfTrait<'a, 'b, T: 'a> { }
818
819 #[cfg(not(cfail1))]
820 #[rustc_dirty(label="hir_owner", cfg="cfail2")]
821 #[rustc_clean(label="hir_owner", cfg="cfail3")]
822 trait TraitAddSecondLifetimeBoundToTypeParameterOfTrait<'a, 'b, T: 'a + 'b> { }
823
824
825
826 // Add second lifetime bound to lifetime parameter of trait
827 #[cfg(cfail1)]
828 trait TraitAddSecondLifetimeBoundToLifetimeParameterOfTrait<'a: 'b, 'b, 'c> { }
829
830 #[cfg(not(cfail1))]
831 #[rustc_dirty(label="hir_owner", cfg="cfail2")]
832 #[rustc_clean(label="hir_owner", cfg="cfail3")]
833 trait TraitAddSecondLifetimeBoundToLifetimeParameterOfTrait<'a: 'b + 'c, 'b, 'c> { }
834
835
836
837 // Add second builtin bound to type parameter of trait
838 #[cfg(cfail1)]
839 trait TraitAddSecondBuiltinBoundToTypeParameterOfTrait<T: Send> { }
840
841 #[cfg(not(cfail1))]
842 #[rustc_dirty(label="hir_owner", cfg="cfail2")]
843 #[rustc_clean(label="hir_owner", cfg="cfail3")]
844 trait TraitAddSecondBuiltinBoundToTypeParameterOfTrait<T: Send + Sync> { }
845
846
847
848 struct ReferenceType0 {}
849 struct ReferenceType1 {}
850
851
852
853 // Add trait bound to type parameter of trait in where clause
854 #[cfg(cfail1)]
855 trait TraitAddTraitBoundToTypeParameterOfTraitWhere<T> { }
856
857 #[cfg(not(cfail1))]
858 #[rustc_dirty(label="hir_owner", cfg="cfail2")]
859 #[rustc_clean(label="hir_owner", cfg="cfail3")]
860 trait TraitAddTraitBoundToTypeParameterOfTraitWhere<T> where T: ReferencedTrait0 { }
861
862
863
864 // Add lifetime bound to type parameter of trait in where clause
865 #[cfg(cfail1)]
866 trait TraitAddLifetimeBoundToTypeParameterOfTraitWhere<'a, T> { }
867
868 #[cfg(not(cfail1))]
869 #[rustc_dirty(label="hir_owner", cfg="cfail2")]
870 #[rustc_clean(label="hir_owner", cfg="cfail3")]
871 trait TraitAddLifetimeBoundToTypeParameterOfTraitWhere<'a, T> where T: 'a { }
872
873
874
875 // Add lifetime bound to lifetime parameter of trait in where clause
876 #[cfg(cfail1)]
877 trait TraitAddLifetimeBoundToLifetimeParameterOfTraitWhere<'a, 'b> { }
878
879 #[cfg(not(cfail1))]
880 #[rustc_dirty(label="hir_owner", cfg="cfail2")]
881 #[rustc_clean(label="hir_owner", cfg="cfail3")]
882 trait TraitAddLifetimeBoundToLifetimeParameterOfTraitWhere<'a, 'b> where 'a: 'b { }
883
884
885
886 // Add builtin bound to type parameter of trait in where clause
887 #[cfg(cfail1)]
888 trait TraitAddBuiltinBoundToTypeParameterOfTraitWhere<T> { }
889
890 #[cfg(not(cfail1))]
891 #[rustc_dirty(label="hir_owner", cfg="cfail2")]
892 #[rustc_clean(label="hir_owner", cfg="cfail3")]
893 trait TraitAddBuiltinBoundToTypeParameterOfTraitWhere<T> where T: Send { }
894
895
896
897 // Add second trait bound to type parameter of trait in where clause
898 #[cfg(cfail1)]
899 trait TraitAddSecondTraitBoundToTypeParameterOfTraitWhere<T> where T: ReferencedTrait0 { }
900
901 #[cfg(not(cfail1))]
902 #[rustc_dirty(label="hir_owner", cfg="cfail2")]
903 #[rustc_clean(label="hir_owner", cfg="cfail3")]
904 trait TraitAddSecondTraitBoundToTypeParameterOfTraitWhere<T>
905     where T: ReferencedTrait0 + ReferencedTrait1 { }
906
907
908
909 // Add second lifetime bound to type parameter of trait in where clause
910 #[cfg(cfail1)]
911 trait TraitAddSecondLifetimeBoundToTypeParameterOfTraitWhere<'a, 'b, T> where T: 'a { }
912
913 #[cfg(not(cfail1))]
914 #[rustc_dirty(label="hir_owner", cfg="cfail2")]
915 #[rustc_clean(label="hir_owner", cfg="cfail3")]
916 trait TraitAddSecondLifetimeBoundToTypeParameterOfTraitWhere<'a, 'b, T> where T: 'a + 'b { }
917
918
919
920 // Add second lifetime bound to lifetime parameter of trait in where clause
921 #[cfg(cfail1)]
922 trait TraitAddSecondLifetimeBoundToLifetimeParameterOfTraitWhere<'a, 'b, 'c> where 'a: 'b { }
923
924 #[cfg(not(cfail1))]
925 #[rustc_dirty(label="hir_owner", cfg="cfail2")]
926 #[rustc_clean(label="hir_owner", cfg="cfail3")]
927 trait TraitAddSecondLifetimeBoundToLifetimeParameterOfTraitWhere<'a, 'b, 'c> where 'a: 'b + 'c { }
928
929
930
931 // Add second builtin bound to type parameter of trait in where clause
932 #[cfg(cfail1)]
933 trait TraitAddSecondBuiltinBoundToTypeParameterOfTraitWhere<T> where T: Send { }
934
935 #[cfg(not(cfail1))]
936 #[rustc_dirty(label="hir_owner", cfg="cfail2")]
937 #[rustc_clean(label="hir_owner", cfg="cfail3")]
938 trait TraitAddSecondBuiltinBoundToTypeParameterOfTraitWhere<T> where T: Send + Sync { }
939
940
941 // Change return type of method indirectly by modifying a use statement
942 mod change_return_type_of_method_indirectly_use {
943     #[cfg(cfail1)]
944     use super::ReferenceType0 as ReturnType;
945     #[cfg(not(cfail1))]
946     use super::ReferenceType1 as ReturnType;
947
948     #[rustc_clean(label="hir_owner", cfg="cfail2")]
949     #[rustc_clean(label="hir_owner", cfg="cfail3")]
950     trait TraitChangeReturnType {
951         #[rustc_dirty(label="hir_owner", cfg="cfail2")]
952         #[rustc_clean(label="hir_owner", cfg="cfail3")]
953         fn method() -> ReturnType;
954     }
955 }
956
957
958
959 // Change type of method parameter indirectly by modifying a use statement
960 mod change_method_parameter_type_indirectly_by_use {
961     #[cfg(cfail1)]
962     use super::ReferenceType0 as ArgType;
963     #[cfg(not(cfail1))]
964     use super::ReferenceType1 as ArgType;
965
966     #[rustc_clean(label="hir_owner", cfg="cfail2")]
967     #[rustc_clean(label="hir_owner", cfg="cfail3")]
968     trait TraitChangeArgType {
969         #[rustc_dirty(label="hir_owner", cfg="cfail2")]
970         #[rustc_clean(label="hir_owner", cfg="cfail3")]
971         fn method(a: ArgType);
972     }
973 }
974
975
976
977 // Change trait bound of method type parameter indirectly by modifying a use statement
978 mod change_method_parameter_type_bound_indirectly_by_use {
979     #[cfg(cfail1)]
980     use super::ReferencedTrait0 as Bound;
981     #[cfg(not(cfail1))]
982     use super::ReferencedTrait1 as Bound;
983
984     #[rustc_clean(label="hir_owner", cfg="cfail2")]
985     #[rustc_clean(label="hir_owner", cfg="cfail3")]
986     trait TraitChangeBoundOfMethodTypeParameter {
987         #[rustc_dirty(label="hir_owner", cfg="cfail2")]
988         #[rustc_clean(label="hir_owner", cfg="cfail3")]
989         fn method<T: Bound>(a: T);
990     }
991 }
992
993
994
995 // Change trait bound of method type parameter in where clause indirectly
996 // by modifying a use statement
997 mod change_method_parameter_type_bound_indirectly_by_use_where {
998     #[cfg(cfail1)]
999     use super::ReferencedTrait0 as Bound;
1000     #[cfg(not(cfail1))]
1001     use super::ReferencedTrait1 as Bound;
1002
1003     #[rustc_clean(label="hir_owner", cfg="cfail2")]
1004     #[rustc_clean(label="hir_owner", cfg="cfail3")]
1005     trait TraitChangeBoundOfMethodTypeParameterWhere {
1006         #[rustc_dirty(label="hir_owner", cfg="cfail2")]
1007         #[rustc_clean(label="hir_owner", cfg="cfail3")]
1008         fn method<T>(a: T) where T: Bound;
1009     }
1010 }
1011
1012
1013
1014 // Change trait bound of trait type parameter indirectly by modifying a use statement
1015 mod change_method_type_parameter_bound_indirectly {
1016     #[cfg(cfail1)]
1017     use super::ReferencedTrait0 as Bound;
1018     #[cfg(not(cfail1))]
1019     use super::ReferencedTrait1 as Bound;
1020
1021     #[rustc_dirty(label="hir_owner", cfg="cfail2")]
1022     #[rustc_clean(label="hir_owner", cfg="cfail3")]
1023     trait TraitChangeTraitBound<T: Bound> {
1024         fn method(a: T);
1025     }
1026 }
1027
1028
1029
1030 // Change trait bound of trait type parameter in where clause indirectly
1031 // by modifying a use statement
1032 mod change_method_type_parameter_bound_indirectly_where {
1033     #[cfg(cfail1)]
1034     use super::ReferencedTrait0 as Bound;
1035     #[cfg(not(cfail1))]
1036     use super::ReferencedTrait1 as Bound;
1037
1038     #[rustc_dirty(label="hir_owner", cfg="cfail2")]
1039     #[rustc_clean(label="hir_owner", cfg="cfail3")]
1040     trait TraitChangeTraitBoundWhere<T> where T: Bound {
1041         fn method(a: T);
1042     }
1043 }