1 // This test case tests the incremental compilation hash (ICH) implementation
2 // for trait definitions.
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.
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.
13 // build-pass (FIXME(62277): could be check-pass?)
14 // revisions: cfail1 cfail2 cfail3
15 // compile-flags: -Z query-dep-graph -Zincremental-ignore-spans
18 #![feature(rustc_attrs)]
20 #![feature(associated_type_defaults)]
21 #![feature(intrinsics)]
24 // Change trait visibility
26 trait TraitVisibility { }
29 #[rustc_dirty(label="Hir", cfg="cfail2")]
30 #[rustc_clean(label="Hir", cfg="cfail3")]
31 pub trait TraitVisibility { }
35 // Change trait unsafety
37 trait TraitUnsafety { }
40 #[rustc_dirty(label="Hir", cfg="cfail2")]
41 #[rustc_clean(label="Hir", cfg="cfail3")]
42 unsafe trait TraitUnsafety { }
48 trait TraitAddMethod {
52 #[rustc_dirty(label="Hir", cfg="cfail2")]
53 #[rustc_clean(label="Hir", cfg="cfail3")]
54 pub trait TraitAddMethod {
60 // Change name of method
62 trait TraitChangeMethodName {
67 #[rustc_dirty(label="Hir", cfg="cfail2")]
68 #[rustc_clean(label="Hir", cfg="cfail3")]
69 trait TraitChangeMethodName {
75 // Add return type to method
77 trait TraitAddReturnType {
82 #[rustc_clean(label="Hir", cfg="cfail2")]
83 #[rustc_clean(label="Hir", cfg="cfail3")]
84 trait TraitAddReturnType {
85 #[rustc_dirty(label="Hir", cfg="cfail2")]
86 #[rustc_clean(label="Hir", cfg="cfail3")]
92 // Change return type of method
94 trait TraitChangeReturnType {
99 #[rustc_clean(label="Hir", cfg="cfail2")]
100 #[rustc_clean(label="Hir", cfg="cfail3")]
101 trait TraitChangeReturnType {
102 #[rustc_dirty(label="Hir", cfg="cfail2")]
103 #[rustc_clean(label="Hir", cfg="cfail3")]
109 // Add parameter to method
111 trait TraitAddParameterToMethod {
116 #[rustc_clean(label="Hir", cfg="cfail2")]
117 #[rustc_clean(label="Hir", cfg="cfail3")]
118 trait TraitAddParameterToMethod {
119 #[rustc_dirty(label="Hir", cfg="cfail2")]
120 #[rustc_clean(label="Hir", cfg="cfail3")]
126 // Change name of method parameter
128 trait TraitChangeMethodParameterName {
130 fn with_default(x: i32) {}
134 #[rustc_clean(label="Hir", cfg="cfail2")]
135 #[rustc_clean(label="Hir", cfg="cfail3")]
136 trait TraitChangeMethodParameterName {
137 // FIXME(#38501) This should preferably always be clean.
138 #[rustc_dirty(label="Hir", cfg="cfail2")]
139 #[rustc_clean(label="Hir", cfg="cfail3")]
142 #[rustc_clean(label="Hir", cfg="cfail2")]
143 #[rustc_clean(label="Hir", cfg="cfail3")]
144 #[rustc_dirty(label="HirBody", cfg="cfail2")]
145 #[rustc_clean(label="HirBody", cfg="cfail3")]
146 fn with_default(y: i32) {}
151 // Change type of method parameter (i32 => i64)
153 trait TraitChangeMethodParameterType {
158 #[rustc_clean(label="Hir", cfg="cfail2")]
159 #[rustc_clean(label="Hir", cfg="cfail3")]
160 trait TraitChangeMethodParameterType {
161 #[rustc_dirty(label="Hir", cfg="cfail2")]
162 #[rustc_clean(label="Hir", cfg="cfail3")]
168 // Change type of method parameter (&i32 => &mut i32)
170 trait TraitChangeMethodParameterTypeRef {
175 #[rustc_clean(label="Hir", cfg="cfail2")]
176 #[rustc_clean(label="Hir", cfg="cfail3")]
177 trait TraitChangeMethodParameterTypeRef {
178 #[rustc_dirty(label="Hir", cfg="cfail2")]
179 #[rustc_clean(label="Hir", cfg="cfail3")]
180 fn method(a: &mut i32);
185 // Change order of method parameters
187 trait TraitChangeMethodParametersOrder {
188 fn method(a: i32, b: i64);
192 #[rustc_clean(label="Hir", cfg="cfail2")]
193 #[rustc_clean(label="Hir", cfg="cfail3")]
194 trait TraitChangeMethodParametersOrder {
195 #[rustc_dirty(label="Hir", cfg="cfail2")]
196 #[rustc_clean(label="Hir", cfg="cfail3")]
197 fn method(b: i64, a: i32);
202 // Add default implementation to method
204 trait TraitAddMethodAutoImplementation {
209 #[rustc_dirty(label="Hir", cfg="cfail2")]
210 #[rustc_clean(label="Hir", cfg="cfail3")]
211 trait TraitAddMethodAutoImplementation {
212 #[rustc_dirty(label="Hir", cfg="cfail2")]
213 #[rustc_clean(label="Hir", cfg="cfail3")]
219 // Change order of methods
221 trait TraitChangeOrderOfMethods {
227 #[rustc_dirty(label="Hir", cfg="cfail2")]
228 #[rustc_clean(label="Hir", cfg="cfail3")]
229 trait TraitChangeOrderOfMethods {
236 // Change mode of self parameter
238 trait TraitChangeModeSelfRefToMut {
243 #[rustc_clean(label="Hir", cfg="cfail2")]
244 #[rustc_clean(label="Hir", cfg="cfail3")]
245 trait TraitChangeModeSelfRefToMut {
246 #[rustc_dirty(label="Hir", cfg="cfail2")]
247 #[rustc_clean(label="Hir", cfg="cfail3")]
248 fn method(&mut self);
254 trait TraitChangeModeSelfOwnToMut: Sized {
259 #[rustc_clean(label="Hir", cfg="cfail2")]
260 #[rustc_clean(label="Hir", cfg="cfail3")]
261 trait TraitChangeModeSelfOwnToMut: Sized {
262 #[rustc_dirty(label="Hir", cfg="cfail2")]
263 #[rustc_clean(label="Hir", cfg="cfail3")]
264 #[rustc_dirty(label="HirBody", cfg="cfail2")]
265 #[rustc_clean(label="HirBody", cfg="cfail3")]
266 fn method(mut self) {}
272 trait TraitChangeModeSelfOwnToRef {
277 #[rustc_clean(label="Hir", cfg="cfail2")]
278 #[rustc_clean(label="Hir", cfg="cfail3")]
279 trait TraitChangeModeSelfOwnToRef {
280 #[rustc_dirty(label="Hir", cfg="cfail2")]
281 #[rustc_clean(label="Hir", cfg="cfail3")]
287 // Add unsafe modifier to method
289 trait TraitAddUnsafeModifier {
294 #[rustc_clean(label="Hir", cfg="cfail2")]
295 #[rustc_clean(label="Hir", cfg="cfail3")]
296 trait TraitAddUnsafeModifier {
297 #[rustc_dirty(label="Hir", cfg="cfail2")]
298 #[rustc_clean(label="Hir", cfg="cfail3")]
304 // Add extern modifier to method
306 trait TraitAddExternModifier {
311 #[rustc_clean(label="Hir", cfg="cfail2")]
312 #[rustc_clean(label="Hir", cfg="cfail3")]
313 trait TraitAddExternModifier {
314 #[rustc_dirty(label="Hir", cfg="cfail2")]
315 #[rustc_clean(label="Hir", cfg="cfail3")]
321 // Change extern "C" to extern "rust-intrinsic"
323 trait TraitChangeExternCToRustIntrinsic {
324 extern "C" fn method();
328 #[rustc_clean(label="Hir", cfg="cfail2")]
329 #[rustc_clean(label="Hir", cfg="cfail3")]
330 trait TraitChangeExternCToRustIntrinsic {
331 #[rustc_dirty(label="Hir", cfg="cfail2")]
332 #[rustc_clean(label="Hir", cfg="cfail3")]
333 extern "rust-intrinsic" fn method();
338 // Add type parameter to method
340 trait TraitAddTypeParameterToMethod {
345 #[rustc_clean(label="Hir", cfg="cfail2")]
346 #[rustc_clean(label="Hir", cfg="cfail3")]
347 trait TraitAddTypeParameterToMethod {
348 #[rustc_dirty(label="Hir", cfg="cfail2")]
349 #[rustc_clean(label="Hir", cfg="cfail3")]
355 // Add lifetime parameter to method
357 trait TraitAddLifetimeParameterToMethod {
362 #[rustc_clean(label="Hir", cfg="cfail2")]
363 #[rustc_clean(label="Hir", cfg="cfail3")]
364 trait TraitAddLifetimeParameterToMethod {
365 #[rustc_dirty(label="Hir", cfg="cfail2")]
366 #[rustc_clean(label="Hir", cfg="cfail3")]
372 // dummy trait for bound
373 trait ReferencedTrait0 { }
374 trait ReferencedTrait1 { }
376 // Add trait bound to method type parameter
378 trait TraitAddTraitBoundToMethodTypeParameter {
383 #[rustc_clean(label="Hir", cfg="cfail2")]
384 #[rustc_clean(label="Hir", cfg="cfail3")]
385 trait TraitAddTraitBoundToMethodTypeParameter {
386 #[rustc_dirty(label="Hir", cfg="cfail2")]
387 #[rustc_clean(label="Hir", cfg="cfail3")]
388 fn method<T: ReferencedTrait0>();
393 // Add builtin bound to method type parameter
395 trait TraitAddBuiltinBoundToMethodTypeParameter {
400 #[rustc_clean(label="Hir", cfg="cfail2")]
401 #[rustc_clean(label="Hir", cfg="cfail3")]
402 trait TraitAddBuiltinBoundToMethodTypeParameter {
403 #[rustc_dirty(label="Hir", cfg="cfail2")]
404 #[rustc_clean(label="Hir", cfg="cfail3")]
405 fn method<T: Sized>();
410 // Add lifetime bound to method lifetime parameter
412 trait TraitAddLifetimeBoundToMethodLifetimeParameter {
413 fn method<'a, 'b>(a: &'a u32, b: &'b u32);
417 #[rustc_clean(label="Hir", cfg="cfail2")]
418 #[rustc_clean(label="Hir", cfg="cfail3")]
419 trait TraitAddLifetimeBoundToMethodLifetimeParameter {
420 #[rustc_dirty(label="Hir", cfg="cfail2")]
421 #[rustc_clean(label="Hir", cfg="cfail3")]
422 fn method<'a, 'b: 'a>(a: &'a u32, b: &'b u32);
427 // Add second trait bound to method type parameter
429 trait TraitAddSecondTraitBoundToMethodTypeParameter {
430 fn method<T: ReferencedTrait0>();
434 #[rustc_clean(label="Hir", cfg="cfail2")]
435 #[rustc_clean(label="Hir", cfg="cfail3")]
436 trait TraitAddSecondTraitBoundToMethodTypeParameter {
437 #[rustc_dirty(label="Hir", cfg="cfail2")]
438 #[rustc_clean(label="Hir", cfg="cfail3")]
439 fn method<T: ReferencedTrait0 + ReferencedTrait1>();
444 // Add second builtin bound to method type parameter
446 trait TraitAddSecondBuiltinBoundToMethodTypeParameter {
447 fn method<T: Sized>();
451 #[rustc_clean(label="Hir", cfg="cfail2")]
452 #[rustc_clean(label="Hir", cfg="cfail3")]
453 trait TraitAddSecondBuiltinBoundToMethodTypeParameter {
454 #[rustc_dirty(label="Hir", cfg="cfail2")]
455 #[rustc_clean(label="Hir", cfg="cfail3")]
456 fn method<T: Sized + Sync>();
461 // Add second lifetime bound to method lifetime parameter
463 trait TraitAddSecondLifetimeBoundToMethodLifetimeParameter {
464 fn method<'a, 'b, 'c: 'a>(a: &'a u32, b: &'b u32, c: &'c u32);
468 #[rustc_clean(label="Hir", cfg="cfail2")]
469 #[rustc_clean(label="Hir", cfg="cfail3")]
470 trait TraitAddSecondLifetimeBoundToMethodLifetimeParameter {
471 #[rustc_dirty(label="Hir", cfg="cfail2")]
472 #[rustc_clean(label="Hir", cfg="cfail3")]
473 fn method<'a, 'b, 'c: 'a + 'b>(a: &'a u32, b: &'b u32, c: &'c u32);
478 // Add associated type
480 trait TraitAddAssociatedType {
482 #[rustc_dirty(label="Hir", cfg="cfail2")]
483 #[rustc_clean(label="Hir", cfg="cfail3")]
488 #[rustc_dirty(label="Hir", cfg="cfail2")]
489 #[rustc_clean(label="Hir", cfg="cfail3")]
490 trait TraitAddAssociatedType {
498 // Add trait bound to associated type
500 trait TraitAddTraitBoundToAssociatedType {
507 // Apparently the type bound contributes to the predicates of the trait, but
508 // does not change the associated item itself.
510 #[rustc_clean(label="Hir", cfg="cfail2")]
511 #[rustc_clean(label="Hir", cfg="cfail3")]
512 trait TraitAddTraitBoundToAssociatedType {
513 #[rustc_dirty(label="Hir", cfg="cfail2")]
514 #[rustc_clean(label="Hir", cfg="cfail3")]
515 type Associated: ReferencedTrait0;
522 // Add lifetime bound to associated type
524 trait TraitAddLifetimeBoundToAssociatedType<'a> {
531 #[rustc_clean(label="Hir", cfg="cfail2")]
532 #[rustc_clean(label="Hir", cfg="cfail3")]
533 trait TraitAddLifetimeBoundToAssociatedType<'a> {
534 #[rustc_dirty(label="Hir", cfg="cfail2")]
535 #[rustc_clean(label="Hir", cfg="cfail3")]
543 // Add default to associated type
545 trait TraitAddDefaultToAssociatedType {
552 #[rustc_dirty(label="Hir", cfg="cfail2")]
553 #[rustc_clean(label="Hir", cfg="cfail3")]
554 trait TraitAddDefaultToAssociatedType {
555 #[rustc_dirty(label="Hir", cfg="cfail2")]
556 #[rustc_clean(label="Hir", cfg="cfail3")]
557 type Associated = ReferenceType0;
564 // Add associated constant
566 trait TraitAddAssociatedConstant {
571 #[rustc_dirty(label="Hir", cfg="cfail2")]
572 #[rustc_clean(label="Hir", cfg="cfail3")]
573 trait TraitAddAssociatedConstant {
581 // Add initializer to associated constant
583 trait TraitAddInitializerToAssociatedConstant {
590 #[rustc_dirty(label="Hir", cfg="cfail2")]
591 #[rustc_clean(label="Hir", cfg="cfail3")]
592 trait TraitAddInitializerToAssociatedConstant {
593 #[rustc_dirty(label="Hir", cfg="cfail2")]
594 #[rustc_clean(label="Hir", cfg="cfail3")]
595 const Value: u32 = 1;
597 #[rustc_clean(label="Hir", cfg="cfail2")]
598 #[rustc_clean(label="Hir", cfg="cfail3")]
604 // Change type of associated constant
606 trait TraitChangeTypeOfAssociatedConstant {
613 #[rustc_clean(label="Hir", cfg="cfail2")]
614 #[rustc_clean(label="Hir", cfg="cfail3")]
615 trait TraitChangeTypeOfAssociatedConstant {
616 #[rustc_dirty(label="Hir", cfg="cfail2")]
617 #[rustc_clean(label="Hir", cfg="cfail3")]
620 #[rustc_clean(label="Hir", cfg="cfail2")]
621 #[rustc_clean(label="Hir", cfg="cfail3")]
629 trait TraitAddSuperTrait { }
632 #[rustc_dirty(label="Hir", cfg="cfail2")]
633 #[rustc_clean(label="Hir", cfg="cfail3")]
634 trait TraitAddSuperTrait : ReferencedTrait0 { }
638 // Add builtin bound (Send or Copy)
640 trait TraitAddBuiltiBound { }
643 #[rustc_dirty(label="Hir", cfg="cfail2")]
644 #[rustc_clean(label="Hir", cfg="cfail3")]
645 trait TraitAddBuiltiBound : Send { }
649 // Add 'static lifetime bound to trait
651 trait TraitAddStaticLifetimeBound { }
654 #[rustc_dirty(label="Hir", cfg="cfail2")]
655 #[rustc_clean(label="Hir", cfg="cfail3")]
656 trait TraitAddStaticLifetimeBound : 'static { }
660 // Add super trait as second bound
662 trait TraitAddTraitAsSecondBound : ReferencedTrait0 { }
665 #[rustc_dirty(label="Hir", cfg="cfail2")]
666 #[rustc_clean(label="Hir", cfg="cfail3")]
667 trait TraitAddTraitAsSecondBound : ReferencedTrait0 + ReferencedTrait1 { }
670 trait TraitAddTraitAsSecondBoundFromBuiltin : Send { }
673 #[rustc_dirty(label="Hir", cfg="cfail2")]
674 #[rustc_clean(label="Hir", cfg="cfail3")]
675 trait TraitAddTraitAsSecondBoundFromBuiltin : Send + ReferencedTrait0 { }
679 // Add builtin bound as second bound
681 trait TraitAddBuiltinBoundAsSecondBound : ReferencedTrait0 { }
684 #[rustc_dirty(label="Hir", cfg="cfail2")]
685 #[rustc_clean(label="Hir", cfg="cfail3")]
686 trait TraitAddBuiltinBoundAsSecondBound : ReferencedTrait0 + Send { }
689 trait TraitAddBuiltinBoundAsSecondBoundFromBuiltin : Send { }
692 #[rustc_dirty(label="Hir", cfg="cfail2")]
693 #[rustc_clean(label="Hir", cfg="cfail3")]
694 trait TraitAddBuiltinBoundAsSecondBoundFromBuiltin: Send + Copy { }
698 // Add 'static bounds as second bound
700 trait TraitAddStaticBoundAsSecondBound : ReferencedTrait0 { }
703 #[rustc_dirty(label="Hir", cfg="cfail2")]
704 #[rustc_clean(label="Hir", cfg="cfail3")]
705 trait TraitAddStaticBoundAsSecondBound : ReferencedTrait0 + 'static { }
708 trait TraitAddStaticBoundAsSecondBoundFromBuiltin : Send { }
711 #[rustc_dirty(label="Hir", cfg="cfail2")]
712 #[rustc_clean(label="Hir", cfg="cfail3")]
713 trait TraitAddStaticBoundAsSecondBoundFromBuiltin : Send + 'static { }
717 // Add type parameter to trait
719 trait TraitAddTypeParameterToTrait { }
722 #[rustc_dirty(label="Hir", cfg="cfail2")]
723 #[rustc_clean(label="Hir", cfg="cfail3")]
724 trait TraitAddTypeParameterToTrait<T> { }
728 // Add lifetime parameter to trait
730 trait TraitAddLifetimeParameterToTrait { }
733 #[rustc_dirty(label="Hir", cfg="cfail2")]
734 #[rustc_clean(label="Hir", cfg="cfail3")]
735 trait TraitAddLifetimeParameterToTrait<'a> { }
739 // Add trait bound to type parameter of trait
741 trait TraitAddTraitBoundToTypeParameterOfTrait<T> { }
744 #[rustc_dirty(label="Hir", cfg="cfail2")]
745 #[rustc_clean(label="Hir", cfg="cfail3")]
746 trait TraitAddTraitBoundToTypeParameterOfTrait<T: ReferencedTrait0> { }
750 // Add lifetime bound to type parameter of trait
752 trait TraitAddLifetimeBoundToTypeParameterOfTrait<'a, T> { }
755 #[rustc_dirty(label="Hir", cfg="cfail2")]
756 #[rustc_clean(label="Hir", cfg="cfail3")]
757 trait TraitAddLifetimeBoundToTypeParameterOfTrait<'a, T: 'a> { }
761 // Add lifetime bound to lifetime parameter of trait
763 trait TraitAddLifetimeBoundToLifetimeParameterOfTrait<'a, 'b> { }
766 #[rustc_dirty(label="Hir", cfg="cfail2")]
767 #[rustc_clean(label="Hir", cfg="cfail3")]
768 trait TraitAddLifetimeBoundToLifetimeParameterOfTrait<'a: 'b, 'b> { }
772 // Add builtin bound to type parameter of trait
774 trait TraitAddBuiltinBoundToTypeParameterOfTrait<T> { }
777 #[rustc_dirty(label="Hir", cfg="cfail2")]
778 #[rustc_clean(label="Hir", cfg="cfail3")]
779 trait TraitAddBuiltinBoundToTypeParameterOfTrait<T: Send> { }
783 // Add second type parameter to trait
785 trait TraitAddSecondTypeParameterToTrait<T> { }
788 #[rustc_dirty(label="Hir", cfg="cfail2")]
789 #[rustc_clean(label="Hir", cfg="cfail3")]
790 trait TraitAddSecondTypeParameterToTrait<T, S> { }
794 // Add second lifetime parameter to trait
796 trait TraitAddSecondLifetimeParameterToTrait<'a> { }
799 #[rustc_dirty(label="Hir", cfg="cfail2")]
800 #[rustc_clean(label="Hir", cfg="cfail3")]
801 trait TraitAddSecondLifetimeParameterToTrait<'a, 'b> { }
805 // Add second trait bound to type parameter of trait
807 trait TraitAddSecondTraitBoundToTypeParameterOfTrait<T: ReferencedTrait0> { }
810 #[rustc_dirty(label="Hir", cfg="cfail2")]
811 #[rustc_clean(label="Hir", cfg="cfail3")]
812 trait TraitAddSecondTraitBoundToTypeParameterOfTrait<T: ReferencedTrait0 + ReferencedTrait1> { }
816 // Add second lifetime bound to type parameter of trait
818 trait TraitAddSecondLifetimeBoundToTypeParameterOfTrait<'a, 'b, T: 'a> { }
821 #[rustc_dirty(label="Hir", cfg="cfail2")]
822 #[rustc_clean(label="Hir", cfg="cfail3")]
823 trait TraitAddSecondLifetimeBoundToTypeParameterOfTrait<'a, 'b, T: 'a + 'b> { }
827 // Add second lifetime bound to lifetime parameter of trait
829 trait TraitAddSecondLifetimeBoundToLifetimeParameterOfTrait<'a: 'b, 'b, 'c> { }
832 #[rustc_dirty(label="Hir", cfg="cfail2")]
833 #[rustc_clean(label="Hir", cfg="cfail3")]
834 trait TraitAddSecondLifetimeBoundToLifetimeParameterOfTrait<'a: 'b + 'c, 'b, 'c> { }
838 // Add second builtin bound to type parameter of trait
840 trait TraitAddSecondBuiltinBoundToTypeParameterOfTrait<T: Send> { }
843 #[rustc_dirty(label="Hir", cfg="cfail2")]
844 #[rustc_clean(label="Hir", cfg="cfail3")]
845 trait TraitAddSecondBuiltinBoundToTypeParameterOfTrait<T: Send + Sync> { }
849 struct ReferenceType0 {}
850 struct ReferenceType1 {}
854 // Add trait bound to type parameter of trait in where clause
856 trait TraitAddTraitBoundToTypeParameterOfTraitWhere<T> { }
859 #[rustc_dirty(label="Hir", cfg="cfail2")]
860 #[rustc_clean(label="Hir", cfg="cfail3")]
861 trait TraitAddTraitBoundToTypeParameterOfTraitWhere<T> where T: ReferencedTrait0 { }
865 // Add lifetime bound to type parameter of trait in where clause
867 trait TraitAddLifetimeBoundToTypeParameterOfTraitWhere<'a, T> { }
870 #[rustc_dirty(label="Hir", cfg="cfail2")]
871 #[rustc_clean(label="Hir", cfg="cfail3")]
872 trait TraitAddLifetimeBoundToTypeParameterOfTraitWhere<'a, T> where T: 'a { }
876 // Add lifetime bound to lifetime parameter of trait in where clause
878 trait TraitAddLifetimeBoundToLifetimeParameterOfTraitWhere<'a, 'b> { }
881 #[rustc_dirty(label="Hir", cfg="cfail2")]
882 #[rustc_clean(label="Hir", cfg="cfail3")]
883 trait TraitAddLifetimeBoundToLifetimeParameterOfTraitWhere<'a, 'b> where 'a: 'b { }
887 // Add builtin bound to type parameter of trait in where clause
889 trait TraitAddBuiltinBoundToTypeParameterOfTraitWhere<T> { }
892 #[rustc_dirty(label="Hir", cfg="cfail2")]
893 #[rustc_clean(label="Hir", cfg="cfail3")]
894 trait TraitAddBuiltinBoundToTypeParameterOfTraitWhere<T> where T: Send { }
898 // Add second trait bound to type parameter of trait in where clause
900 trait TraitAddSecondTraitBoundToTypeParameterOfTraitWhere<T> where T: ReferencedTrait0 { }
903 #[rustc_dirty(label="Hir", cfg="cfail2")]
904 #[rustc_clean(label="Hir", cfg="cfail3")]
905 trait TraitAddSecondTraitBoundToTypeParameterOfTraitWhere<T>
906 where T: ReferencedTrait0 + ReferencedTrait1 { }
910 // Add second lifetime bound to type parameter of trait in where clause
912 trait TraitAddSecondLifetimeBoundToTypeParameterOfTraitWhere<'a, 'b, T> where T: 'a { }
915 #[rustc_dirty(label="Hir", cfg="cfail2")]
916 #[rustc_clean(label="Hir", cfg="cfail3")]
917 trait TraitAddSecondLifetimeBoundToTypeParameterOfTraitWhere<'a, 'b, T> where T: 'a + 'b { }
921 // Add second lifetime bound to lifetime parameter of trait in where clause
923 trait TraitAddSecondLifetimeBoundToLifetimeParameterOfTraitWhere<'a, 'b, 'c> where 'a: 'b { }
926 #[rustc_dirty(label="Hir", cfg="cfail2")]
927 #[rustc_clean(label="Hir", cfg="cfail3")]
928 trait TraitAddSecondLifetimeBoundToLifetimeParameterOfTraitWhere<'a, 'b, 'c> where 'a: 'b + 'c { }
932 // Add second builtin bound to type parameter of trait in where clause
934 trait TraitAddSecondBuiltinBoundToTypeParameterOfTraitWhere<T> where T: Send { }
937 #[rustc_dirty(label="Hir", cfg="cfail2")]
938 #[rustc_clean(label="Hir", cfg="cfail3")]
939 trait TraitAddSecondBuiltinBoundToTypeParameterOfTraitWhere<T> where T: Send + Sync { }
942 // Change return type of method indirectly by modifying a use statement
943 mod change_return_type_of_method_indirectly_use {
945 use super::ReferenceType0 as ReturnType;
947 use super::ReferenceType1 as ReturnType;
949 #[rustc_clean(label="Hir", cfg="cfail2")]
950 #[rustc_clean(label="Hir", cfg="cfail3")]
951 trait TraitChangeReturnType {
952 #[rustc_dirty(label="Hir", cfg="cfail2")]
953 #[rustc_clean(label="Hir", cfg="cfail3")]
954 fn method() -> ReturnType;
960 // Change type of method parameter indirectly by modifying a use statement
961 mod change_method_parameter_type_indirectly_by_use {
963 use super::ReferenceType0 as ArgType;
965 use super::ReferenceType1 as ArgType;
967 #[rustc_clean(label="Hir", cfg="cfail2")]
968 #[rustc_clean(label="Hir", cfg="cfail3")]
969 trait TraitChangeArgType {
970 #[rustc_dirty(label="Hir", cfg="cfail2")]
971 #[rustc_clean(label="Hir", cfg="cfail3")]
972 fn method(a: ArgType);
978 // Change trait bound of method type parameter indirectly by modifying a use statement
979 mod change_method_parameter_type_bound_indirectly_by_use {
981 use super::ReferencedTrait0 as Bound;
983 use super::ReferencedTrait1 as Bound;
985 #[rustc_clean(label="Hir", cfg="cfail2")]
986 #[rustc_clean(label="Hir", cfg="cfail3")]
987 trait TraitChangeBoundOfMethodTypeParameter {
988 #[rustc_dirty(label="Hir", cfg="cfail2")]
989 #[rustc_clean(label="Hir", cfg="cfail3")]
990 fn method<T: Bound>(a: T);
996 // Change trait bound of method type parameter in where clause indirectly
997 // by modifying a use statement
998 mod change_method_parameter_type_bound_indirectly_by_use_where {
1000 use super::ReferencedTrait0 as Bound;
1002 use super::ReferencedTrait1 as Bound;
1004 #[rustc_clean(label="Hir", cfg="cfail2")]
1005 #[rustc_clean(label="Hir", cfg="cfail3")]
1006 trait TraitChangeBoundOfMethodTypeParameterWhere {
1007 #[rustc_dirty(label="Hir", cfg="cfail2")]
1008 #[rustc_clean(label="Hir", cfg="cfail3")]
1009 fn method<T>(a: T) where T: Bound;
1015 // Change trait bound of trait type parameter indirectly by modifying a use statement
1016 mod change_method_type_parameter_bound_indirectly {
1018 use super::ReferencedTrait0 as Bound;
1020 use super::ReferencedTrait1 as Bound;
1022 #[rustc_dirty(label="Hir", cfg="cfail2")]
1023 #[rustc_clean(label="Hir", cfg="cfail3")]
1024 trait TraitChangeTraitBound<T: Bound> {
1031 // Change trait bound of trait type parameter in where clause indirectly
1032 // by modifying a use statement
1033 mod change_method_type_parameter_bound_indirectly_where {
1035 use super::ReferencedTrait0 as Bound;
1037 use super::ReferencedTrait1 as Bound;
1039 #[rustc_dirty(label="Hir", cfg="cfail2")]
1040 #[rustc_clean(label="Hir", cfg="cfail3")]
1041 trait TraitChangeTraitBoundWhere<T> where T: Bound {