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)]
23 // Change trait visibility
25 trait TraitVisibility { }
28 #[rustc_dirty(label="Hir", cfg="cfail2")]
29 #[rustc_clean(label="Hir", cfg="cfail3")]
30 pub trait TraitVisibility { }
34 // Change trait unsafety
36 trait TraitUnsafety { }
39 #[rustc_dirty(label="Hir", cfg="cfail2")]
40 #[rustc_clean(label="Hir", cfg="cfail3")]
41 unsafe trait TraitUnsafety { }
47 trait TraitAddMethod {
51 #[rustc_dirty(label="Hir", cfg="cfail2")]
52 #[rustc_clean(label="Hir", cfg="cfail3")]
53 pub trait TraitAddMethod {
59 // Change name of method
61 trait TraitChangeMethodName {
66 #[rustc_dirty(label="Hir", cfg="cfail2")]
67 #[rustc_clean(label="Hir", cfg="cfail3")]
68 trait TraitChangeMethodName {
74 // Add return type to method
76 trait TraitAddReturnType {
81 #[rustc_clean(label="Hir", cfg="cfail2")]
82 #[rustc_clean(label="Hir", cfg="cfail3")]
83 trait TraitAddReturnType {
84 #[rustc_dirty(label="Hir", cfg="cfail2")]
85 #[rustc_clean(label="Hir", cfg="cfail3")]
91 // Change return type of method
93 trait TraitChangeReturnType {
98 #[rustc_clean(label="Hir", cfg="cfail2")]
99 #[rustc_clean(label="Hir", cfg="cfail3")]
100 trait TraitChangeReturnType {
101 #[rustc_dirty(label="Hir", cfg="cfail2")]
102 #[rustc_clean(label="Hir", cfg="cfail3")]
108 // Add parameter to method
110 trait TraitAddParameterToMethod {
115 #[rustc_clean(label="Hir", cfg="cfail2")]
116 #[rustc_clean(label="Hir", cfg="cfail3")]
117 trait TraitAddParameterToMethod {
118 #[rustc_dirty(label="Hir", cfg="cfail2")]
119 #[rustc_clean(label="Hir", cfg="cfail3")]
125 // Change name of method parameter
127 trait TraitChangeMethodParameterName {
129 fn with_default(x: i32) {}
133 #[rustc_clean(label="Hir", cfg="cfail2")]
134 #[rustc_clean(label="Hir", cfg="cfail3")]
135 trait TraitChangeMethodParameterName {
136 // FIXME(#38501) This should preferably always be clean.
137 #[rustc_dirty(label="Hir", cfg="cfail2")]
138 #[rustc_clean(label="Hir", cfg="cfail3")]
141 #[rustc_clean(label="Hir", cfg="cfail2")]
142 #[rustc_clean(label="Hir", cfg="cfail3")]
143 #[rustc_dirty(label="HirBody", cfg="cfail2")]
144 #[rustc_clean(label="HirBody", cfg="cfail3")]
145 fn with_default(y: i32) {}
150 // Change type of method parameter (i32 => i64)
152 trait TraitChangeMethodParameterType {
157 #[rustc_clean(label="Hir", cfg="cfail2")]
158 #[rustc_clean(label="Hir", cfg="cfail3")]
159 trait TraitChangeMethodParameterType {
160 #[rustc_dirty(label="Hir", cfg="cfail2")]
161 #[rustc_clean(label="Hir", cfg="cfail3")]
167 // Change type of method parameter (&i32 => &mut i32)
169 trait TraitChangeMethodParameterTypeRef {
174 #[rustc_clean(label="Hir", cfg="cfail2")]
175 #[rustc_clean(label="Hir", cfg="cfail3")]
176 trait TraitChangeMethodParameterTypeRef {
177 #[rustc_dirty(label="Hir", cfg="cfail2")]
178 #[rustc_clean(label="Hir", cfg="cfail3")]
179 fn method(a: &mut i32);
184 // Change order of method parameters
186 trait TraitChangeMethodParametersOrder {
187 fn method(a: i32, b: i64);
191 #[rustc_clean(label="Hir", cfg="cfail2")]
192 #[rustc_clean(label="Hir", cfg="cfail3")]
193 trait TraitChangeMethodParametersOrder {
194 #[rustc_dirty(label="Hir", cfg="cfail2")]
195 #[rustc_clean(label="Hir", cfg="cfail3")]
196 fn method(b: i64, a: i32);
201 // Add default implementation to method
203 trait TraitAddMethodAutoImplementation {
208 #[rustc_dirty(label="Hir", cfg="cfail2")]
209 #[rustc_clean(label="Hir", cfg="cfail3")]
210 trait TraitAddMethodAutoImplementation {
211 #[rustc_dirty(label="Hir", cfg="cfail2")]
212 #[rustc_clean(label="Hir", cfg="cfail3")]
218 // Change order of methods
220 trait TraitChangeOrderOfMethods {
226 #[rustc_dirty(label="Hir", cfg="cfail2")]
227 #[rustc_clean(label="Hir", cfg="cfail3")]
228 trait TraitChangeOrderOfMethods {
235 // Change mode of self parameter
237 trait TraitChangeModeSelfRefToMut {
242 #[rustc_clean(label="Hir", cfg="cfail2")]
243 #[rustc_clean(label="Hir", cfg="cfail3")]
244 trait TraitChangeModeSelfRefToMut {
245 #[rustc_dirty(label="Hir", cfg="cfail2")]
246 #[rustc_clean(label="Hir", cfg="cfail3")]
247 fn method(&mut self);
253 trait TraitChangeModeSelfOwnToMut: Sized {
258 #[rustc_clean(label="Hir", cfg="cfail2")]
259 #[rustc_clean(label="Hir", cfg="cfail3")]
260 trait TraitChangeModeSelfOwnToMut: Sized {
261 #[rustc_dirty(label="Hir", cfg="cfail2")]
262 #[rustc_clean(label="Hir", cfg="cfail3")]
263 #[rustc_dirty(label="HirBody", cfg="cfail2")]
264 #[rustc_clean(label="HirBody", cfg="cfail3")]
265 fn method(mut self) {}
271 trait TraitChangeModeSelfOwnToRef {
276 #[rustc_clean(label="Hir", cfg="cfail2")]
277 #[rustc_clean(label="Hir", cfg="cfail3")]
278 trait TraitChangeModeSelfOwnToRef {
279 #[rustc_dirty(label="Hir", cfg="cfail2")]
280 #[rustc_clean(label="Hir", cfg="cfail3")]
286 // Add unsafe modifier to method
288 trait TraitAddUnsafeModifier {
293 #[rustc_clean(label="Hir", cfg="cfail2")]
294 #[rustc_clean(label="Hir", cfg="cfail3")]
295 trait TraitAddUnsafeModifier {
296 #[rustc_dirty(label="Hir", cfg="cfail2")]
297 #[rustc_clean(label="Hir", cfg="cfail3")]
303 // Add extern modifier to method
305 trait TraitAddExternModifier {
310 #[rustc_clean(label="Hir", cfg="cfail2")]
311 #[rustc_clean(label="Hir", cfg="cfail3")]
312 trait TraitAddExternModifier {
313 #[rustc_dirty(label="Hir", cfg="cfail2")]
314 #[rustc_clean(label="Hir", cfg="cfail3")]
320 // Change extern "C" to extern "stdcall"
322 trait TraitChangeExternCToRustIntrinsic {
323 extern "C" fn method();
327 #[rustc_clean(label="Hir", cfg="cfail2")]
328 #[rustc_clean(label="Hir", cfg="cfail3")]
329 trait TraitChangeExternCToRustIntrinsic {
330 #[rustc_dirty(label="Hir", cfg="cfail2")]
331 #[rustc_clean(label="Hir", cfg="cfail3")]
332 extern "stdcall" fn method();
337 // Add type parameter to method
339 trait TraitAddTypeParameterToMethod {
344 #[rustc_clean(label="Hir", cfg="cfail2")]
345 #[rustc_clean(label="Hir", cfg="cfail3")]
346 trait TraitAddTypeParameterToMethod {
347 #[rustc_dirty(label="Hir", cfg="cfail2")]
348 #[rustc_clean(label="Hir", cfg="cfail3")]
354 // Add lifetime parameter to method
356 trait TraitAddLifetimeParameterToMethod {
361 #[rustc_clean(label="Hir", cfg="cfail2")]
362 #[rustc_clean(label="Hir", cfg="cfail3")]
363 trait TraitAddLifetimeParameterToMethod {
364 #[rustc_dirty(label="Hir", cfg="cfail2")]
365 #[rustc_clean(label="Hir", cfg="cfail3")]
371 // dummy trait for bound
372 trait ReferencedTrait0 { }
373 trait ReferencedTrait1 { }
375 // Add trait bound to method type parameter
377 trait TraitAddTraitBoundToMethodTypeParameter {
382 #[rustc_clean(label="Hir", cfg="cfail2")]
383 #[rustc_clean(label="Hir", cfg="cfail3")]
384 trait TraitAddTraitBoundToMethodTypeParameter {
385 #[rustc_dirty(label="Hir", cfg="cfail2")]
386 #[rustc_clean(label="Hir", cfg="cfail3")]
387 fn method<T: ReferencedTrait0>();
392 // Add builtin bound to method type parameter
394 trait TraitAddBuiltinBoundToMethodTypeParameter {
399 #[rustc_clean(label="Hir", cfg="cfail2")]
400 #[rustc_clean(label="Hir", cfg="cfail3")]
401 trait TraitAddBuiltinBoundToMethodTypeParameter {
402 #[rustc_dirty(label="Hir", cfg="cfail2")]
403 #[rustc_clean(label="Hir", cfg="cfail3")]
404 fn method<T: Sized>();
409 // Add lifetime bound to method lifetime parameter
411 trait TraitAddLifetimeBoundToMethodLifetimeParameter {
412 fn method<'a, 'b>(a: &'a u32, b: &'b u32);
416 #[rustc_clean(label="Hir", cfg="cfail2")]
417 #[rustc_clean(label="Hir", cfg="cfail3")]
418 trait TraitAddLifetimeBoundToMethodLifetimeParameter {
419 #[rustc_dirty(label="Hir", cfg="cfail2")]
420 #[rustc_clean(label="Hir", cfg="cfail3")]
421 fn method<'a, 'b: 'a>(a: &'a u32, b: &'b u32);
426 // Add second trait bound to method type parameter
428 trait TraitAddSecondTraitBoundToMethodTypeParameter {
429 fn method<T: ReferencedTrait0>();
433 #[rustc_clean(label="Hir", cfg="cfail2")]
434 #[rustc_clean(label="Hir", cfg="cfail3")]
435 trait TraitAddSecondTraitBoundToMethodTypeParameter {
436 #[rustc_dirty(label="Hir", cfg="cfail2")]
437 #[rustc_clean(label="Hir", cfg="cfail3")]
438 fn method<T: ReferencedTrait0 + ReferencedTrait1>();
443 // Add second builtin bound to method type parameter
445 trait TraitAddSecondBuiltinBoundToMethodTypeParameter {
446 fn method<T: Sized>();
450 #[rustc_clean(label="Hir", cfg="cfail2")]
451 #[rustc_clean(label="Hir", cfg="cfail3")]
452 trait TraitAddSecondBuiltinBoundToMethodTypeParameter {
453 #[rustc_dirty(label="Hir", cfg="cfail2")]
454 #[rustc_clean(label="Hir", cfg="cfail3")]
455 fn method<T: Sized + Sync>();
460 // Add second lifetime bound to method lifetime parameter
462 trait TraitAddSecondLifetimeBoundToMethodLifetimeParameter {
463 fn method<'a, 'b, 'c: 'a>(a: &'a u32, b: &'b u32, c: &'c u32);
467 #[rustc_clean(label="Hir", cfg="cfail2")]
468 #[rustc_clean(label="Hir", cfg="cfail3")]
469 trait TraitAddSecondLifetimeBoundToMethodLifetimeParameter {
470 #[rustc_dirty(label="Hir", cfg="cfail2")]
471 #[rustc_clean(label="Hir", cfg="cfail3")]
472 fn method<'a, 'b, 'c: 'a + 'b>(a: &'a u32, b: &'b u32, c: &'c u32);
477 // Add associated type
479 trait TraitAddAssociatedType {
481 #[rustc_dirty(label="Hir", cfg="cfail2")]
482 #[rustc_clean(label="Hir", cfg="cfail3")]
487 #[rustc_dirty(label="Hir", cfg="cfail2")]
488 #[rustc_clean(label="Hir", cfg="cfail3")]
489 trait TraitAddAssociatedType {
497 // Add trait bound to associated type
499 trait TraitAddTraitBoundToAssociatedType {
506 // Apparently the type bound contributes to the predicates of the trait, but
507 // does not change the associated item itself.
509 #[rustc_clean(label="Hir", cfg="cfail2")]
510 #[rustc_clean(label="Hir", cfg="cfail3")]
511 trait TraitAddTraitBoundToAssociatedType {
512 #[rustc_dirty(label="Hir", cfg="cfail2")]
513 #[rustc_clean(label="Hir", cfg="cfail3")]
514 type Associated: ReferencedTrait0;
521 // Add lifetime bound to associated type
523 trait TraitAddLifetimeBoundToAssociatedType<'a> {
530 #[rustc_clean(label="Hir", cfg="cfail2")]
531 #[rustc_clean(label="Hir", cfg="cfail3")]
532 trait TraitAddLifetimeBoundToAssociatedType<'a> {
533 #[rustc_dirty(label="Hir", cfg="cfail2")]
534 #[rustc_clean(label="Hir", cfg="cfail3")]
542 // Add default to associated type
544 trait TraitAddDefaultToAssociatedType {
551 #[rustc_dirty(label="Hir", cfg="cfail2")]
552 #[rustc_clean(label="Hir", cfg="cfail3")]
553 trait TraitAddDefaultToAssociatedType {
554 #[rustc_dirty(label="Hir", cfg="cfail2")]
555 #[rustc_clean(label="Hir", cfg="cfail3")]
556 type Associated = ReferenceType0;
563 // Add associated constant
565 trait TraitAddAssociatedConstant {
570 #[rustc_dirty(label="Hir", cfg="cfail2")]
571 #[rustc_clean(label="Hir", cfg="cfail3")]
572 trait TraitAddAssociatedConstant {
580 // Add initializer to associated constant
582 trait TraitAddInitializerToAssociatedConstant {
589 #[rustc_dirty(label="Hir", cfg="cfail2")]
590 #[rustc_clean(label="Hir", cfg="cfail3")]
591 trait TraitAddInitializerToAssociatedConstant {
592 #[rustc_dirty(label="Hir", cfg="cfail2")]
593 #[rustc_clean(label="Hir", cfg="cfail3")]
594 const Value: u32 = 1;
596 #[rustc_clean(label="Hir", cfg="cfail2")]
597 #[rustc_clean(label="Hir", cfg="cfail3")]
603 // Change type of associated constant
605 trait TraitChangeTypeOfAssociatedConstant {
612 #[rustc_clean(label="Hir", cfg="cfail2")]
613 #[rustc_clean(label="Hir", cfg="cfail3")]
614 trait TraitChangeTypeOfAssociatedConstant {
615 #[rustc_dirty(label="Hir", cfg="cfail2")]
616 #[rustc_clean(label="Hir", cfg="cfail3")]
619 #[rustc_clean(label="Hir", cfg="cfail2")]
620 #[rustc_clean(label="Hir", cfg="cfail3")]
628 trait TraitAddSuperTrait { }
631 #[rustc_dirty(label="Hir", cfg="cfail2")]
632 #[rustc_clean(label="Hir", cfg="cfail3")]
633 trait TraitAddSuperTrait : ReferencedTrait0 { }
637 // Add builtin bound (Send or Copy)
639 trait TraitAddBuiltiBound { }
642 #[rustc_dirty(label="Hir", cfg="cfail2")]
643 #[rustc_clean(label="Hir", cfg="cfail3")]
644 trait TraitAddBuiltiBound : Send { }
648 // Add 'static lifetime bound to trait
650 trait TraitAddStaticLifetimeBound { }
653 #[rustc_dirty(label="Hir", cfg="cfail2")]
654 #[rustc_clean(label="Hir", cfg="cfail3")]
655 trait TraitAddStaticLifetimeBound : 'static { }
659 // Add super trait as second bound
661 trait TraitAddTraitAsSecondBound : ReferencedTrait0 { }
664 #[rustc_dirty(label="Hir", cfg="cfail2")]
665 #[rustc_clean(label="Hir", cfg="cfail3")]
666 trait TraitAddTraitAsSecondBound : ReferencedTrait0 + ReferencedTrait1 { }
669 trait TraitAddTraitAsSecondBoundFromBuiltin : Send { }
672 #[rustc_dirty(label="Hir", cfg="cfail2")]
673 #[rustc_clean(label="Hir", cfg="cfail3")]
674 trait TraitAddTraitAsSecondBoundFromBuiltin : Send + ReferencedTrait0 { }
678 // Add builtin bound as second bound
680 trait TraitAddBuiltinBoundAsSecondBound : ReferencedTrait0 { }
683 #[rustc_dirty(label="Hir", cfg="cfail2")]
684 #[rustc_clean(label="Hir", cfg="cfail3")]
685 trait TraitAddBuiltinBoundAsSecondBound : ReferencedTrait0 + Send { }
688 trait TraitAddBuiltinBoundAsSecondBoundFromBuiltin : Send { }
691 #[rustc_dirty(label="Hir", cfg="cfail2")]
692 #[rustc_clean(label="Hir", cfg="cfail3")]
693 trait TraitAddBuiltinBoundAsSecondBoundFromBuiltin: Send + Copy { }
697 // Add 'static bounds as second bound
699 trait TraitAddStaticBoundAsSecondBound : ReferencedTrait0 { }
702 #[rustc_dirty(label="Hir", cfg="cfail2")]
703 #[rustc_clean(label="Hir", cfg="cfail3")]
704 trait TraitAddStaticBoundAsSecondBound : ReferencedTrait0 + 'static { }
707 trait TraitAddStaticBoundAsSecondBoundFromBuiltin : Send { }
710 #[rustc_dirty(label="Hir", cfg="cfail2")]
711 #[rustc_clean(label="Hir", cfg="cfail3")]
712 trait TraitAddStaticBoundAsSecondBoundFromBuiltin : Send + 'static { }
716 // Add type parameter to trait
718 trait TraitAddTypeParameterToTrait { }
721 #[rustc_dirty(label="Hir", cfg="cfail2")]
722 #[rustc_clean(label="Hir", cfg="cfail3")]
723 trait TraitAddTypeParameterToTrait<T> { }
727 // Add lifetime parameter to trait
729 trait TraitAddLifetimeParameterToTrait { }
732 #[rustc_dirty(label="Hir", cfg="cfail2")]
733 #[rustc_clean(label="Hir", cfg="cfail3")]
734 trait TraitAddLifetimeParameterToTrait<'a> { }
738 // Add trait bound to type parameter of trait
740 trait TraitAddTraitBoundToTypeParameterOfTrait<T> { }
743 #[rustc_dirty(label="Hir", cfg="cfail2")]
744 #[rustc_clean(label="Hir", cfg="cfail3")]
745 trait TraitAddTraitBoundToTypeParameterOfTrait<T: ReferencedTrait0> { }
749 // Add lifetime bound to type parameter of trait
751 trait TraitAddLifetimeBoundToTypeParameterOfTrait<'a, T> { }
754 #[rustc_dirty(label="Hir", cfg="cfail2")]
755 #[rustc_clean(label="Hir", cfg="cfail3")]
756 trait TraitAddLifetimeBoundToTypeParameterOfTrait<'a, T: 'a> { }
760 // Add lifetime bound to lifetime parameter of trait
762 trait TraitAddLifetimeBoundToLifetimeParameterOfTrait<'a, 'b> { }
765 #[rustc_dirty(label="Hir", cfg="cfail2")]
766 #[rustc_clean(label="Hir", cfg="cfail3")]
767 trait TraitAddLifetimeBoundToLifetimeParameterOfTrait<'a: 'b, 'b> { }
771 // Add builtin bound to type parameter of trait
773 trait TraitAddBuiltinBoundToTypeParameterOfTrait<T> { }
776 #[rustc_dirty(label="Hir", cfg="cfail2")]
777 #[rustc_clean(label="Hir", cfg="cfail3")]
778 trait TraitAddBuiltinBoundToTypeParameterOfTrait<T: Send> { }
782 // Add second type parameter to trait
784 trait TraitAddSecondTypeParameterToTrait<T> { }
787 #[rustc_dirty(label="Hir", cfg="cfail2")]
788 #[rustc_clean(label="Hir", cfg="cfail3")]
789 trait TraitAddSecondTypeParameterToTrait<T, S> { }
793 // Add second lifetime parameter to trait
795 trait TraitAddSecondLifetimeParameterToTrait<'a> { }
798 #[rustc_dirty(label="Hir", cfg="cfail2")]
799 #[rustc_clean(label="Hir", cfg="cfail3")]
800 trait TraitAddSecondLifetimeParameterToTrait<'a, 'b> { }
804 // Add second trait bound to type parameter of trait
806 trait TraitAddSecondTraitBoundToTypeParameterOfTrait<T: ReferencedTrait0> { }
809 #[rustc_dirty(label="Hir", cfg="cfail2")]
810 #[rustc_clean(label="Hir", cfg="cfail3")]
811 trait TraitAddSecondTraitBoundToTypeParameterOfTrait<T: ReferencedTrait0 + ReferencedTrait1> { }
815 // Add second lifetime bound to type parameter of trait
817 trait TraitAddSecondLifetimeBoundToTypeParameterOfTrait<'a, 'b, T: 'a> { }
820 #[rustc_dirty(label="Hir", cfg="cfail2")]
821 #[rustc_clean(label="Hir", cfg="cfail3")]
822 trait TraitAddSecondLifetimeBoundToTypeParameterOfTrait<'a, 'b, T: 'a + 'b> { }
826 // Add second lifetime bound to lifetime parameter of trait
828 trait TraitAddSecondLifetimeBoundToLifetimeParameterOfTrait<'a: 'b, 'b, 'c> { }
831 #[rustc_dirty(label="Hir", cfg="cfail2")]
832 #[rustc_clean(label="Hir", cfg="cfail3")]
833 trait TraitAddSecondLifetimeBoundToLifetimeParameterOfTrait<'a: 'b + 'c, 'b, 'c> { }
837 // Add second builtin bound to type parameter of trait
839 trait TraitAddSecondBuiltinBoundToTypeParameterOfTrait<T: Send> { }
842 #[rustc_dirty(label="Hir", cfg="cfail2")]
843 #[rustc_clean(label="Hir", cfg="cfail3")]
844 trait TraitAddSecondBuiltinBoundToTypeParameterOfTrait<T: Send + Sync> { }
848 struct ReferenceType0 {}
849 struct ReferenceType1 {}
853 // Add trait bound to type parameter of trait in where clause
855 trait TraitAddTraitBoundToTypeParameterOfTraitWhere<T> { }
858 #[rustc_dirty(label="Hir", cfg="cfail2")]
859 #[rustc_clean(label="Hir", cfg="cfail3")]
860 trait TraitAddTraitBoundToTypeParameterOfTraitWhere<T> where T: ReferencedTrait0 { }
864 // Add lifetime bound to type parameter of trait in where clause
866 trait TraitAddLifetimeBoundToTypeParameterOfTraitWhere<'a, T> { }
869 #[rustc_dirty(label="Hir", cfg="cfail2")]
870 #[rustc_clean(label="Hir", cfg="cfail3")]
871 trait TraitAddLifetimeBoundToTypeParameterOfTraitWhere<'a, T> where T: 'a { }
875 // Add lifetime bound to lifetime parameter of trait in where clause
877 trait TraitAddLifetimeBoundToLifetimeParameterOfTraitWhere<'a, 'b> { }
880 #[rustc_dirty(label="Hir", cfg="cfail2")]
881 #[rustc_clean(label="Hir", cfg="cfail3")]
882 trait TraitAddLifetimeBoundToLifetimeParameterOfTraitWhere<'a, 'b> where 'a: 'b { }
886 // Add builtin bound to type parameter of trait in where clause
888 trait TraitAddBuiltinBoundToTypeParameterOfTraitWhere<T> { }
891 #[rustc_dirty(label="Hir", cfg="cfail2")]
892 #[rustc_clean(label="Hir", cfg="cfail3")]
893 trait TraitAddBuiltinBoundToTypeParameterOfTraitWhere<T> where T: Send { }
897 // Add second trait bound to type parameter of trait in where clause
899 trait TraitAddSecondTraitBoundToTypeParameterOfTraitWhere<T> where T: ReferencedTrait0 { }
902 #[rustc_dirty(label="Hir", cfg="cfail2")]
903 #[rustc_clean(label="Hir", cfg="cfail3")]
904 trait TraitAddSecondTraitBoundToTypeParameterOfTraitWhere<T>
905 where T: ReferencedTrait0 + ReferencedTrait1 { }
909 // Add second lifetime bound to type parameter of trait in where clause
911 trait TraitAddSecondLifetimeBoundToTypeParameterOfTraitWhere<'a, 'b, T> where T: 'a { }
914 #[rustc_dirty(label="Hir", cfg="cfail2")]
915 #[rustc_clean(label="Hir", cfg="cfail3")]
916 trait TraitAddSecondLifetimeBoundToTypeParameterOfTraitWhere<'a, 'b, T> where T: 'a + 'b { }
920 // Add second lifetime bound to lifetime parameter of trait in where clause
922 trait TraitAddSecondLifetimeBoundToLifetimeParameterOfTraitWhere<'a, 'b, 'c> where 'a: 'b { }
925 #[rustc_dirty(label="Hir", cfg="cfail2")]
926 #[rustc_clean(label="Hir", cfg="cfail3")]
927 trait TraitAddSecondLifetimeBoundToLifetimeParameterOfTraitWhere<'a, 'b, 'c> where 'a: 'b + 'c { }
931 // Add second builtin bound to type parameter of trait in where clause
933 trait TraitAddSecondBuiltinBoundToTypeParameterOfTraitWhere<T> where T: Send { }
936 #[rustc_dirty(label="Hir", cfg="cfail2")]
937 #[rustc_clean(label="Hir", cfg="cfail3")]
938 trait TraitAddSecondBuiltinBoundToTypeParameterOfTraitWhere<T> where T: Send + Sync { }
941 // Change return type of method indirectly by modifying a use statement
942 mod change_return_type_of_method_indirectly_use {
944 use super::ReferenceType0 as ReturnType;
946 use super::ReferenceType1 as ReturnType;
948 #[rustc_clean(label="Hir", cfg="cfail2")]
949 #[rustc_clean(label="Hir", cfg="cfail3")]
950 trait TraitChangeReturnType {
951 #[rustc_dirty(label="Hir", cfg="cfail2")]
952 #[rustc_clean(label="Hir", cfg="cfail3")]
953 fn method() -> ReturnType;
959 // Change type of method parameter indirectly by modifying a use statement
960 mod change_method_parameter_type_indirectly_by_use {
962 use super::ReferenceType0 as ArgType;
964 use super::ReferenceType1 as ArgType;
966 #[rustc_clean(label="Hir", cfg="cfail2")]
967 #[rustc_clean(label="Hir", cfg="cfail3")]
968 trait TraitChangeArgType {
969 #[rustc_dirty(label="Hir", cfg="cfail2")]
970 #[rustc_clean(label="Hir", cfg="cfail3")]
971 fn method(a: ArgType);
977 // Change trait bound of method type parameter indirectly by modifying a use statement
978 mod change_method_parameter_type_bound_indirectly_by_use {
980 use super::ReferencedTrait0 as Bound;
982 use super::ReferencedTrait1 as Bound;
984 #[rustc_clean(label="Hir", cfg="cfail2")]
985 #[rustc_clean(label="Hir", cfg="cfail3")]
986 trait TraitChangeBoundOfMethodTypeParameter {
987 #[rustc_dirty(label="Hir", cfg="cfail2")]
988 #[rustc_clean(label="Hir", cfg="cfail3")]
989 fn method<T: Bound>(a: T);
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 {
999 use super::ReferencedTrait0 as Bound;
1001 use super::ReferencedTrait1 as Bound;
1003 #[rustc_clean(label="Hir", cfg="cfail2")]
1004 #[rustc_clean(label="Hir", cfg="cfail3")]
1005 trait TraitChangeBoundOfMethodTypeParameterWhere {
1006 #[rustc_dirty(label="Hir", cfg="cfail2")]
1007 #[rustc_clean(label="Hir", cfg="cfail3")]
1008 fn method<T>(a: T) where T: Bound;
1014 // Change trait bound of trait type parameter indirectly by modifying a use statement
1015 mod change_method_type_parameter_bound_indirectly {
1017 use super::ReferencedTrait0 as Bound;
1019 use super::ReferencedTrait1 as Bound;
1021 #[rustc_dirty(label="Hir", cfg="cfail2")]
1022 #[rustc_clean(label="Hir", cfg="cfail3")]
1023 trait TraitChangeTraitBound<T: Bound> {
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 {
1034 use super::ReferencedTrait0 as Bound;
1036 use super::ReferencedTrait1 as Bound;
1038 #[rustc_dirty(label="Hir", cfg="cfail2")]
1039 #[rustc_clean(label="Hir", cfg="cfail3")]
1040 trait TraitChangeTraitBoundWhere<T> where T: Bound {