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.
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.
12 // This test case tests the incremental compilation hash (ICH) implementation
13 // for trait definitions.
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.
19 // We also test the ICH for trait 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 trait's metadata, and that it stays
22 // the same between rev2 and rev3.
24 // must-compile-successfully
25 // revisions: cfail1 cfail2 cfail3
26 // compile-flags: -Z query-dep-graph
29 #![feature(rustc_attrs)]
31 #![feature(associated_type_defaults)]
32 #![feature(intrinsics)]
33 #![feature(associated_consts)]
36 // Change trait visibility --------------------------------------------------------
38 trait TraitVisibility { }
41 #[rustc_dirty(label="Hir", cfg="cfail2")]
42 #[rustc_clean(label="Hir", cfg="cfail3")]
43 #[rustc_metadata_clean(cfg="cfail3")]
44 pub trait TraitVisibility { }
48 // Change trait unsafety ----------------------------------------------------------
50 trait TraitUnsafety { }
53 #[rustc_dirty(label="Hir", cfg="cfail2")]
54 #[rustc_clean(label="Hir", cfg="cfail3")]
55 #[rustc_metadata_dirty(cfg="cfail2")]
56 #[rustc_metadata_clean(cfg="cfail3")]
57 unsafe trait TraitUnsafety { }
61 // Add method ---------------------------------------------------------------------
63 trait TraitAddMethod
{
67 #[rustc_dirty(label="Hir", cfg="cfail2")]
68 #[rustc_clean(label="Hir", cfg="cfail3")]
69 #[rustc_metadata_dirty(cfg="cfail2")]
70 #[rustc_metadata_clean(cfg="cfail3")]
71 pub trait TraitAddMethod
{
77 // Change name of method ----------------------------------------------------------
79 trait TraitChangeMethodName
{
84 #[rustc_dirty(label="Hir", cfg="cfail2")]
85 #[rustc_clean(label="Hir", cfg="cfail3")]
86 #[rustc_metadata_dirty(cfg="cfail2")]
87 #[rustc_metadata_clean(cfg="cfail3")]
88 trait TraitChangeMethodName
{
94 // Add return type to method ------------------------------------------------------
96 trait TraitAddReturnType
{
101 #[rustc_clean(label="Hir", cfg="cfail2")]
102 #[rustc_clean(label="Hir", cfg="cfail3")]
103 #[rustc_metadata_dirty(cfg="cfail2")]
104 #[rustc_metadata_clean(cfg="cfail3")]
105 trait TraitAddReturnType
{
106 #[rustc_dirty(label="Hir", cfg="cfail2")]
107 #[rustc_clean(label="Hir", cfg="cfail3")]
108 #[rustc_metadata_dirty(cfg="cfail2")]
109 #[rustc_metadata_clean(cfg="cfail3")]
115 // Change return type of method ---------------------------------------------------
117 trait TraitChangeReturnType
{
122 #[rustc_clean(label="Hir", cfg="cfail2")]
123 #[rustc_clean(label="Hir", cfg="cfail3")]
124 #[rustc_metadata_dirty(cfg="cfail2")]
125 #[rustc_metadata_clean(cfg="cfail3")]
126 trait TraitChangeReturnType
{
127 #[rustc_dirty(label="Hir", cfg="cfail2")]
128 #[rustc_clean(label="Hir", cfg="cfail3")]
129 #[rustc_metadata_dirty(cfg="cfail2")]
130 #[rustc_metadata_clean(cfg="cfail3")]
136 // Add parameter to method --------------------------------------------------------
138 trait TraitAddParameterToMethod
{
143 #[rustc_clean(label="Hir", cfg="cfail2")]
144 #[rustc_clean(label="Hir", cfg="cfail3")]
145 #[rustc_metadata_dirty(cfg="cfail2")]
146 #[rustc_metadata_clean(cfg="cfail3")]
147 trait TraitAddParameterToMethod
{
148 #[rustc_dirty(label="Hir", cfg="cfail2")]
149 #[rustc_clean(label="Hir", cfg="cfail3")]
150 #[rustc_metadata_dirty(cfg="cfail2")]
151 #[rustc_metadata_clean(cfg="cfail3")]
157 // Change name of method parameter ------------------------------------------------
159 trait TraitChangeMethodParameterName
{
161 fn with_default(x
: i32) {}
165 #[rustc_clean(label="Hir", cfg="cfail2")]
166 #[rustc_clean(label="Hir", cfg="cfail3")]
167 #[rustc_metadata_dirty(cfg="cfail2")]
168 #[rustc_metadata_clean(cfg="cfail3")]
169 trait TraitChangeMethodParameterName
{
170 // FIXME(#38501) This should preferably always be clean.
171 #[rustc_dirty(label="Hir", cfg="cfail2")]
172 #[rustc_clean(label="Hir", cfg="cfail3")]
173 #[rustc_metadata_dirty(cfg="cfail2")]
174 #[rustc_metadata_clean(cfg="cfail3")]
177 #[rustc_clean(label="Hir", cfg="cfail2")]
178 #[rustc_clean(label="Hir", cfg="cfail3")]
179 #[rustc_dirty(label="HirBody", cfg="cfail2")]
180 #[rustc_clean(label="HirBody", cfg="cfail3")]
181 #[rustc_metadata_dirty(cfg="cfail2")]
182 #[rustc_metadata_clean(cfg="cfail3")]
183 fn with_default(y
: i32) {}
188 // Change type of method parameter (i32 => i64) -----------------------------------
190 trait TraitChangeMethodParameterType
{
195 #[rustc_clean(label="Hir", cfg="cfail2")]
196 #[rustc_clean(label="Hir", cfg="cfail3")]
197 #[rustc_metadata_dirty(cfg="cfail2")]
198 #[rustc_metadata_clean(cfg="cfail3")]
199 trait TraitChangeMethodParameterType
{
200 #[rustc_dirty(label="Hir", cfg="cfail2")]
201 #[rustc_clean(label="Hir", cfg="cfail3")]
202 #[rustc_metadata_dirty(cfg="cfail2")]
203 #[rustc_metadata_clean(cfg="cfail3")]
209 // Change type of method parameter (&i32 => &mut i32) -----------------------------
211 trait TraitChangeMethodParameterTypeRef
{
216 #[rustc_clean(label="Hir", cfg="cfail2")]
217 #[rustc_clean(label="Hir", cfg="cfail3")]
218 #[rustc_metadata_dirty(cfg="cfail2")]
219 #[rustc_metadata_clean(cfg="cfail3")]
220 trait TraitChangeMethodParameterTypeRef
{
221 #[rustc_dirty(label="Hir", cfg="cfail2")]
222 #[rustc_clean(label="Hir", cfg="cfail3")]
223 #[rustc_metadata_dirty(cfg="cfail2")]
224 #[rustc_metadata_clean(cfg="cfail3")]
225 fn method(a
: &mut i32);
230 // Change order of method parameters ----------------------------------------------
232 trait TraitChangeMethodParametersOrder
{
233 fn method(a
: i32, b
: i64);
237 #[rustc_clean(label="Hir", cfg="cfail2")]
238 #[rustc_clean(label="Hir", cfg="cfail3")]
239 #[rustc_metadata_dirty(cfg="cfail2")]
240 #[rustc_metadata_clean(cfg="cfail3")]
241 trait TraitChangeMethodParametersOrder
{
242 #[rustc_dirty(label="Hir", cfg="cfail2")]
243 #[rustc_clean(label="Hir", cfg="cfail3")]
244 #[rustc_metadata_dirty(cfg="cfail2")]
245 #[rustc_metadata_clean(cfg="cfail3")]
246 fn method(b
: i64, a
: i32);
251 // Add default implementation to method -------------------------------------------
253 trait TraitAddMethodDefaultImplementation
{
258 #[rustc_dirty(label="Hir", cfg="cfail2")]
259 #[rustc_clean(label="Hir", cfg="cfail3")]
260 #[rustc_metadata_dirty(cfg="cfail2")]
261 #[rustc_metadata_clean(cfg="cfail3")]
262 trait TraitAddMethodDefaultImplementation
{
268 // Change order of methods --------------------------------------------------------
270 trait TraitChangeOrderOfMethods
{
276 #[rustc_dirty(label="Hir", cfg="cfail2")]
277 #[rustc_clean(label="Hir", cfg="cfail3")]
278 #[rustc_metadata_dirty(cfg="cfail2")]
279 #[rustc_metadata_clean(cfg="cfail3")]
280 trait TraitChangeOrderOfMethods
{
287 // Change mode of self parameter --------------------------------------------------
289 trait TraitChangeModeSelfRefToMut
{
294 #[rustc_clean(label="Hir", cfg="cfail2")]
295 #[rustc_clean(label="Hir", cfg="cfail3")]
296 #[rustc_metadata_dirty(cfg="cfail2")]
297 #[rustc_metadata_clean(cfg="cfail3")]
298 trait TraitChangeModeSelfRefToMut
{
299 #[rustc_dirty(label="Hir", cfg="cfail2")]
300 #[rustc_clean(label="Hir", cfg="cfail3")]
301 #[rustc_metadata_dirty(cfg="cfail2")]
302 #[rustc_metadata_clean(cfg="cfail3")]
303 fn method(&mut self);
309 trait TraitChangeModeSelfOwnToMut
: Sized
{
314 #[rustc_clean(label="Hir", cfg="cfail2")]
315 #[rustc_clean(label="Hir", cfg="cfail3")]
316 #[rustc_metadata_clean(cfg="cfail2")]
317 #[rustc_metadata_clean(cfg="cfail3")]
318 trait TraitChangeModeSelfOwnToMut
: Sized
{
319 #[rustc_clean(label="Hir", cfg="cfail2")]
320 #[rustc_clean(label="Hir", cfg="cfail3")]
321 #[rustc_dirty(label="HirBody", cfg="cfail2")]
322 #[rustc_clean(label="HirBody", cfg="cfail3")]
323 #[rustc_metadata_dirty(cfg="cfail2")]
324 #[rustc_metadata_clean(cfg="cfail3")]
325 fn method(mut self) {}
331 trait TraitChangeModeSelfOwnToRef
{
336 #[rustc_clean(label="Hir", cfg="cfail2")]
337 #[rustc_clean(label="Hir", cfg="cfail3")]
338 #[rustc_metadata_dirty(cfg="cfail2")]
339 #[rustc_metadata_clean(cfg="cfail3")]
340 trait TraitChangeModeSelfOwnToRef
{
341 #[rustc_dirty(label="Hir", cfg="cfail2")]
342 #[rustc_clean(label="Hir", cfg="cfail3")]
343 #[rustc_metadata_dirty(cfg="cfail2")]
344 #[rustc_metadata_clean(cfg="cfail3")]
350 // Add unsafe modifier to method --------------------------------------------------
352 trait TraitAddUnsafeModifier
{
357 #[rustc_clean(label="Hir", cfg="cfail2")]
358 #[rustc_clean(label="Hir", cfg="cfail3")]
359 #[rustc_metadata_dirty(cfg="cfail2")]
360 #[rustc_metadata_clean(cfg="cfail3")]
361 trait TraitAddUnsafeModifier
{
362 #[rustc_dirty(label="Hir", cfg="cfail2")]
363 #[rustc_clean(label="Hir", cfg="cfail3")]
364 #[rustc_metadata_dirty(cfg="cfail2")]
365 #[rustc_metadata_clean(cfg="cfail3")]
371 // Add extern modifier to method --------------------------------------------------
373 trait TraitAddExternModifier
{
378 #[rustc_clean(label="Hir", cfg="cfail2")]
379 #[rustc_clean(label="Hir", cfg="cfail3")]
380 #[rustc_metadata_dirty(cfg="cfail2")]
381 #[rustc_metadata_clean(cfg="cfail3")]
382 trait TraitAddExternModifier
{
383 #[rustc_dirty(label="Hir", cfg="cfail2")]
384 #[rustc_clean(label="Hir", cfg="cfail3")]
385 #[rustc_metadata_dirty(cfg="cfail2")]
386 #[rustc_metadata_clean(cfg="cfail3")]
392 // Change extern "C" to extern "rust-intrinsic" -----------------------------------
394 trait TraitChangeExternCToRustIntrinsic
{
395 extern "C" fn method();
399 #[rustc_clean(label="Hir", cfg="cfail2")]
400 #[rustc_clean(label="Hir", cfg="cfail3")]
401 #[rustc_metadata_dirty(cfg="cfail2")]
402 #[rustc_metadata_clean(cfg="cfail3")]
403 trait TraitChangeExternCToRustIntrinsic
{
404 #[rustc_dirty(label="Hir", cfg="cfail2")]
405 #[rustc_clean(label="Hir", cfg="cfail3")]
406 #[rustc_metadata_dirty(cfg="cfail2")]
407 #[rustc_metadata_clean(cfg="cfail3")]
408 extern "rust-intrinsic" fn method();
413 // Add type parameter to method ---------------------------------------------------
415 trait TraitAddTypeParameterToMethod
{
420 #[rustc_clean(label="Hir", cfg="cfail2")]
421 #[rustc_clean(label="Hir", cfg="cfail3")]
422 #[rustc_metadata_dirty(cfg="cfail2")]
423 #[rustc_metadata_clean(cfg="cfail3")]
424 trait TraitAddTypeParameterToMethod
{
425 #[rustc_dirty(label="Hir", cfg="cfail2")]
426 #[rustc_clean(label="Hir", cfg="cfail3")]
427 #[rustc_metadata_dirty(cfg="cfail2")]
428 #[rustc_metadata_clean(cfg="cfail3")]
434 // Add lifetime parameter to method -----------------------------------------------
436 trait TraitAddLifetimeParameterToMethod
{
441 #[rustc_clean(label="Hir", cfg="cfail2")]
442 #[rustc_clean(label="Hir", cfg="cfail3")]
443 #[rustc_metadata_dirty(cfg="cfail2")]
444 #[rustc_metadata_clean(cfg="cfail3")]
445 trait TraitAddLifetimeParameterToMethod
{
446 #[rustc_dirty(label="Hir", cfg="cfail2")]
447 #[rustc_clean(label="Hir", cfg="cfail3")]
448 #[rustc_metadata_dirty(cfg="cfail2")]
449 #[rustc_metadata_clean(cfg="cfail3")]
455 // dummy trait for bound
456 trait ReferencedTrait0 { }
457 trait ReferencedTrait1 { }
459 // Add trait bound to method type parameter ---------------------------------------
461 trait TraitAddTraitBoundToMethodTypeParameter
{
466 #[rustc_clean(label="Hir", cfg="cfail2")]
467 #[rustc_clean(label="Hir", cfg="cfail3")]
468 #[rustc_metadata_dirty(cfg="cfail2")]
469 #[rustc_metadata_clean(cfg="cfail3")]
470 trait TraitAddTraitBoundToMethodTypeParameter
{
471 #[rustc_dirty(label="Hir", cfg="cfail2")]
472 #[rustc_clean(label="Hir", cfg="cfail3")]
473 #[rustc_metadata_dirty(cfg="cfail2")]
474 #[rustc_metadata_clean(cfg="cfail3")]
475 fn method
<T
: ReferencedTrait0
>();
480 // Add builtin bound to method type parameter -------------------------------------
482 trait TraitAddBuiltinBoundToMethodTypeParameter
{
487 #[rustc_clean(label="Hir", cfg="cfail2")]
488 #[rustc_clean(label="Hir", cfg="cfail3")]
489 #[rustc_metadata_dirty(cfg="cfail2")]
490 #[rustc_metadata_clean(cfg="cfail3")]
491 trait TraitAddBuiltinBoundToMethodTypeParameter
{
492 #[rustc_dirty(label="Hir", cfg="cfail2")]
493 #[rustc_clean(label="Hir", cfg="cfail3")]
494 #[rustc_metadata_dirty(cfg="cfail2")]
495 #[rustc_metadata_clean(cfg="cfail3")]
496 fn method
<T
: Sized
>();
501 // Add lifetime bound to method lifetime parameter ------------------------------------
503 trait TraitAddLifetimeBoundToMethodLifetimeParameter
{
504 fn method
<'a
, 'b
>(a
: &'a
u32, b
: &'b
u32);
508 #[rustc_clean(label="Hir", cfg="cfail2")]
509 #[rustc_clean(label="Hir", cfg="cfail3")]
510 #[rustc_metadata_dirty(cfg="cfail2")]
511 #[rustc_metadata_clean(cfg="cfail3")]
512 trait TraitAddLifetimeBoundToMethodLifetimeParameter
{
513 #[rustc_dirty(label="Hir", cfg="cfail2")]
514 #[rustc_clean(label="Hir", cfg="cfail3")]
515 #[rustc_metadata_dirty(cfg="cfail2")]
516 #[rustc_metadata_clean(cfg="cfail3")]
517 fn method
<'a
, 'b
: 'a
>(a
: &'a
u32, b
: &'b
u32);
522 // Add second trait bound to method type parameter --------------------------------
524 trait TraitAddSecondTraitBoundToMethodTypeParameter
{
525 fn method
<T
: ReferencedTrait0
>();
529 #[rustc_clean(label="Hir", cfg="cfail2")]
530 #[rustc_clean(label="Hir", cfg="cfail3")]
531 #[rustc_metadata_dirty(cfg="cfail2")]
532 #[rustc_metadata_clean(cfg="cfail3")]
533 trait TraitAddSecondTraitBoundToMethodTypeParameter
{
534 #[rustc_dirty(label="Hir", cfg="cfail2")]
535 #[rustc_clean(label="Hir", cfg="cfail3")]
536 #[rustc_metadata_dirty(cfg="cfail2")]
537 #[rustc_metadata_clean(cfg="cfail3")]
538 fn method
<T
: ReferencedTrait0
+ ReferencedTrait1
>();
543 // Add second builtin bound to method type parameter ------------------------------
545 trait TraitAddSecondBuiltinBoundToMethodTypeParameter
{
546 fn method
<T
: Sized
>();
550 #[rustc_clean(label="Hir", cfg="cfail2")]
551 #[rustc_clean(label="Hir", cfg="cfail3")]
552 #[rustc_metadata_dirty(cfg="cfail2")]
553 #[rustc_metadata_clean(cfg="cfail3")]
554 trait TraitAddSecondBuiltinBoundToMethodTypeParameter
{
555 #[rustc_dirty(label="Hir", cfg="cfail2")]
556 #[rustc_clean(label="Hir", cfg="cfail3")]
557 #[rustc_metadata_dirty(cfg="cfail2")]
558 #[rustc_metadata_clean(cfg="cfail3")]
559 fn method
<T
: Sized
+ Sync
>();
564 // Add second lifetime bound to method lifetime parameter -----------------------------
566 trait TraitAddSecondLifetimeBoundToMethodLifetimeParameter
{
567 fn method
<'a
, 'b
, 'c
: 'a
>(a
: &'a
u32, b
: &'b
u32, c
: &'c
u32);
571 #[rustc_clean(label="Hir", cfg="cfail2")]
572 #[rustc_clean(label="Hir", cfg="cfail3")]
573 #[rustc_metadata_dirty(cfg="cfail2")]
574 #[rustc_metadata_clean(cfg="cfail3")]
575 trait TraitAddSecondLifetimeBoundToMethodLifetimeParameter
{
576 #[rustc_dirty(label="Hir", cfg="cfail2")]
577 #[rustc_clean(label="Hir", cfg="cfail3")]
578 #[rustc_metadata_dirty(cfg="cfail2")]
579 #[rustc_metadata_clean(cfg="cfail3")]
580 fn method
<'a
, 'b
, 'c
: 'a
+ 'b
>(a
: &'a
u32, b
: &'b
u32, c
: &'c
u32);
585 // Add associated type ------------------------------------------------------------
587 trait TraitAddAssociatedType
{
592 #[rustc_dirty(label="Hir", cfg="cfail2")]
593 #[rustc_clean(label="Hir", cfg="cfail3")]
594 #[rustc_metadata_dirty(cfg="cfail2")]
595 #[rustc_metadata_clean(cfg="cfail3")]
596 trait TraitAddAssociatedType
{
604 // Add trait bound to associated type ---------------------------------------------
606 trait TraitAddTraitBoundToAssociatedType
{
613 #[rustc_clean(label="Hir", cfg="cfail2")]
614 #[rustc_clean(label="Hir", cfg="cfail3")]
615 #[rustc_metadata_dirty(cfg="cfail2")]
616 #[rustc_metadata_clean(cfg="cfail3")]
617 trait TraitAddTraitBoundToAssociatedType
{
618 #[rustc_dirty(label="Hir", cfg="cfail2")]
619 #[rustc_clean(label="Hir", cfg="cfail3")]
620 #[rustc_metadata_dirty(cfg="cfail2")]
621 #[rustc_metadata_clean(cfg="cfail3")]
622 type Associated
: ReferencedTrait0
;
629 // Add lifetime bound to associated type ------------------------------------------
631 trait TraitAddLifetimeBoundToAssociatedType
<'a
> {
638 #[rustc_clean(label="Hir", cfg="cfail2")]
639 #[rustc_clean(label="Hir", cfg="cfail3")]
640 #[rustc_metadata_dirty(cfg="cfail2")]
641 #[rustc_metadata_clean(cfg="cfail3")]
642 trait TraitAddLifetimeBoundToAssociatedType
<'a
> {
643 #[rustc_dirty(label="Hir", cfg="cfail2")]
644 #[rustc_clean(label="Hir", cfg="cfail3")]
645 #[rustc_metadata_dirty(cfg="cfail2")]
646 #[rustc_metadata_clean(cfg="cfail3")]
654 // Add default to associated type -------------------------------------------------
656 trait TraitAddDefaultToAssociatedType
{
663 #[rustc_dirty(label="Hir", cfg="cfail2")]
664 #[rustc_clean(label="Hir", cfg="cfail3")]
665 #[rustc_metadata_dirty(cfg="cfail2")]
666 #[rustc_metadata_clean(cfg="cfail3")]
667 trait TraitAddDefaultToAssociatedType
{
668 type Associated
= ReferenceType0
;
675 // Add associated constant --------------------------------------------------------
677 trait TraitAddAssociatedConstant
{
682 #[rustc_dirty(label="Hir", cfg="cfail2")]
683 #[rustc_clean(label="Hir", cfg="cfail3")]
684 #[rustc_metadata_dirty(cfg="cfail2")]
685 #[rustc_metadata_clean(cfg="cfail3")]
686 trait TraitAddAssociatedConstant
{
694 // Add initializer to associated constant -----------------------------------------
696 trait TraitAddInitializerToAssociatedConstant
{
703 #[rustc_dirty(label="Hir", cfg="cfail2")]
704 #[rustc_clean(label="Hir", cfg="cfail3")]
705 #[rustc_metadata_dirty(cfg="cfail2")]
706 #[rustc_metadata_clean(cfg="cfail3")]
707 trait TraitAddInitializerToAssociatedConstant
{
708 const Value
: u32 = 1;
715 // Change type of associated constant ---------------------------------------------
717 trait TraitChangeTypeOfAssociatedConstant
{
724 #[rustc_clean(label="Hir", cfg="cfail2")]
725 #[rustc_clean(label="Hir", cfg="cfail3")]
726 #[rustc_metadata_dirty(cfg="cfail2")]
727 #[rustc_metadata_clean(cfg="cfail3")]
728 trait TraitChangeTypeOfAssociatedConstant
{
729 #[rustc_dirty(label="Hir", cfg="cfail2")]
730 #[rustc_clean(label="Hir", cfg="cfail3")]
731 #[rustc_metadata_dirty(cfg="cfail2")]
732 #[rustc_metadata_clean(cfg="cfail3")]
740 // Add super trait ----------------------------------------------------------------
742 trait TraitAddSuperTrait { }
745 #[rustc_dirty(label="Hir", cfg="cfail2")]
746 #[rustc_clean(label="Hir", cfg="cfail3")]
747 #[rustc_metadata_dirty(cfg="cfail2")]
748 #[rustc_metadata_clean(cfg="cfail3")]
749 trait TraitAddSuperTrait
: ReferencedTrait0 { }
753 // Add builtin bound (Send or Copy) -----------------------------------------------
755 trait TraitAddBuiltiBound { }
758 #[rustc_dirty(label="Hir", cfg="cfail2")]
759 #[rustc_clean(label="Hir", cfg="cfail3")]
760 #[rustc_metadata_dirty(cfg="cfail2")]
761 #[rustc_metadata_clean(cfg="cfail3")]
762 trait TraitAddBuiltiBound
: Send { }
766 // Add 'static lifetime bound to trait --------------------------------------------
768 trait TraitAddStaticLifetimeBound { }
771 #[rustc_dirty(label="Hir", cfg="cfail2")]
772 #[rustc_clean(label="Hir", cfg="cfail3")]
773 #[rustc_metadata_dirty(cfg="cfail2")]
774 #[rustc_metadata_clean(cfg="cfail3")]
775 trait TraitAddStaticLifetimeBound
: '
static { }
779 // Add super trait as second bound ------------------------------------------------
781 trait TraitAddTraitAsSecondBound
: ReferencedTrait0 { }
784 #[rustc_dirty(label="Hir", cfg="cfail2")]
785 #[rustc_clean(label="Hir", cfg="cfail3")]
786 #[rustc_metadata_dirty(cfg="cfail2")]
787 #[rustc_metadata_clean(cfg="cfail3")]
788 trait TraitAddTraitAsSecondBound
: ReferencedTrait0
+ ReferencedTrait1 { }
791 trait TraitAddTraitAsSecondBoundFromBuiltin
: Send { }
794 #[rustc_dirty(label="Hir", cfg="cfail2")]
795 #[rustc_clean(label="Hir", cfg="cfail3")]
796 #[rustc_metadata_dirty(cfg="cfail2")]
797 #[rustc_metadata_clean(cfg="cfail3")]
798 trait TraitAddTraitAsSecondBoundFromBuiltin
: Send
+ ReferencedTrait0 { }
802 // Add builtin bound as second bound ----------------------------------------------
804 trait TraitAddBuiltinBoundAsSecondBound
: ReferencedTrait0 { }
807 #[rustc_dirty(label="Hir", cfg="cfail2")]
808 #[rustc_clean(label="Hir", cfg="cfail3")]
809 #[rustc_metadata_dirty(cfg="cfail2")]
810 #[rustc_metadata_clean(cfg="cfail3")]
811 trait TraitAddBuiltinBoundAsSecondBound
: ReferencedTrait0
+ Send { }
814 trait TraitAddBuiltinBoundAsSecondBoundFromBuiltin
: Send { }
817 #[rustc_dirty(label="Hir", cfg="cfail2")]
818 #[rustc_clean(label="Hir", cfg="cfail3")]
819 #[rustc_metadata_dirty(cfg="cfail2")]
820 #[rustc_metadata_clean(cfg="cfail3")]
821 trait TraitAddBuiltinBoundAsSecondBoundFromBuiltin
: Send
+ Copy { }
825 // Add 'static bounds as second bound ---------------------------------------------
827 trait TraitAddStaticBoundAsSecondBound
: ReferencedTrait0 { }
830 #[rustc_dirty(label="Hir", cfg="cfail2")]
831 #[rustc_clean(label="Hir", cfg="cfail3")]
832 #[rustc_metadata_dirty(cfg="cfail2")]
833 #[rustc_metadata_clean(cfg="cfail3")]
834 trait TraitAddStaticBoundAsSecondBound
: ReferencedTrait0
+ '
static { }
837 trait TraitAddStaticBoundAsSecondBoundFromBuiltin
: Send { }
840 #[rustc_dirty(label="Hir", cfg="cfail2")]
841 #[rustc_clean(label="Hir", cfg="cfail3")]
842 #[rustc_metadata_dirty(cfg="cfail2")]
843 #[rustc_metadata_clean(cfg="cfail3")]
844 trait TraitAddStaticBoundAsSecondBoundFromBuiltin
: Send
+ '
static { }
848 // Add type parameter to trait ----------------------------------------------------
850 trait TraitAddTypeParameterToTrait { }
853 #[rustc_dirty(label="Hir", cfg="cfail2")]
854 #[rustc_clean(label="Hir", cfg="cfail3")]
855 #[rustc_metadata_dirty(cfg="cfail2")]
856 #[rustc_metadata_clean(cfg="cfail3")]
857 trait TraitAddTypeParameterToTrait
<T
> { }
861 // Add lifetime parameter to trait ------------------------------------------------
863 trait TraitAddLifetimeParameterToTrait { }
866 #[rustc_dirty(label="Hir", cfg="cfail2")]
867 #[rustc_clean(label="Hir", cfg="cfail3")]
868 #[rustc_metadata_dirty(cfg="cfail2")]
869 #[rustc_metadata_clean(cfg="cfail3")]
870 trait TraitAddLifetimeParameterToTrait
<'a
> { }
874 // Add trait bound to type parameter of trait -------------------------------------
876 trait TraitAddTraitBoundToTypeParameterOfTrait
<T
> { }
879 #[rustc_dirty(label="Hir", cfg="cfail2")]
880 #[rustc_clean(label="Hir", cfg="cfail3")]
881 #[rustc_metadata_dirty(cfg="cfail2")]
882 #[rustc_metadata_clean(cfg="cfail3")]
883 trait TraitAddTraitBoundToTypeParameterOfTrait
<T
: ReferencedTrait0
> { }
887 // Add lifetime bound to type parameter of trait ----------------------------------
889 trait TraitAddLifetimeBoundToTypeParameterOfTrait
<'a
, T
> { }
892 #[rustc_dirty(label="Hir", cfg="cfail2")]
893 #[rustc_clean(label="Hir", cfg="cfail3")]
894 #[rustc_metadata_dirty(cfg="cfail2")]
895 #[rustc_metadata_clean(cfg="cfail3")]
896 trait TraitAddLifetimeBoundToTypeParameterOfTrait
<'a
, T
: 'a
> { }
900 // Add lifetime bound to lifetime parameter of trait ------------------------------
902 trait TraitAddLifetimeBoundToLifetimeParameterOfTrait
<'a
, 'b
> { }
905 #[rustc_dirty(label="Hir", cfg="cfail2")]
906 #[rustc_clean(label="Hir", cfg="cfail3")]
907 #[rustc_metadata_dirty(cfg="cfail2")]
908 #[rustc_metadata_clean(cfg="cfail3")]
909 trait TraitAddLifetimeBoundToLifetimeParameterOfTrait
<'a
: 'b
, 'b
> { }
913 // Add builtin bound to type parameter of trait -----------------------------------
915 trait TraitAddBuiltinBoundToTypeParameterOfTrait
<T
> { }
918 #[rustc_dirty(label="Hir", cfg="cfail2")]
919 #[rustc_clean(label="Hir", cfg="cfail3")]
920 #[rustc_metadata_dirty(cfg="cfail2")]
921 #[rustc_metadata_clean(cfg="cfail3")]
922 trait TraitAddBuiltinBoundToTypeParameterOfTrait
<T
: Send
> { }
926 // Add second type parameter to trait ---------------------------------------------
928 trait TraitAddSecondTypeParameterToTrait
<T
> { }
931 #[rustc_dirty(label="Hir", cfg="cfail2")]
932 #[rustc_clean(label="Hir", cfg="cfail3")]
933 #[rustc_metadata_dirty(cfg="cfail2")]
934 #[rustc_metadata_clean(cfg="cfail3")]
935 trait TraitAddSecondTypeParameterToTrait
<T
, S
> { }
939 // Add second lifetime parameter to trait -----------------------------------------
941 trait TraitAddSecondLifetimeParameterToTrait
<'a
> { }
944 #[rustc_dirty(label="Hir", cfg="cfail2")]
945 #[rustc_clean(label="Hir", cfg="cfail3")]
946 #[rustc_metadata_dirty(cfg="cfail2")]
947 #[rustc_metadata_clean(cfg="cfail3")]
948 trait TraitAddSecondLifetimeParameterToTrait
<'a
, 'b
> { }
952 // Add second trait bound to type parameter of trait ------------------------------
954 trait TraitAddSecondTraitBoundToTypeParameterOfTrait
<T
: ReferencedTrait0
> { }
957 #[rustc_dirty(label="Hir", cfg="cfail2")]
958 #[rustc_clean(label="Hir", cfg="cfail3")]
959 #[rustc_metadata_dirty(cfg="cfail2")]
960 #[rustc_metadata_clean(cfg="cfail3")]
961 trait TraitAddSecondTraitBoundToTypeParameterOfTrait
<T
: ReferencedTrait0
+ ReferencedTrait1
> { }
965 // Add second lifetime bound to type parameter of trait ---------------------------
967 trait TraitAddSecondLifetimeBoundToTypeParameterOfTrait
<'a
, 'b
, T
: 'a
> { }
970 #[rustc_dirty(label="Hir", cfg="cfail2")]
971 #[rustc_clean(label="Hir", cfg="cfail3")]
972 #[rustc_metadata_dirty(cfg="cfail2")]
973 #[rustc_metadata_clean(cfg="cfail3")]
974 trait TraitAddSecondLifetimeBoundToTypeParameterOfTrait
<'a
, 'b
, T
: 'a
+ 'b
> { }
978 // Add second lifetime bound to lifetime parameter of trait------------------------
980 trait TraitAddSecondLifetimeBoundToLifetimeParameterOfTrait
<'a
: 'b
, 'b
, 'c
> { }
983 #[rustc_dirty(label="Hir", cfg="cfail2")]
984 #[rustc_clean(label="Hir", cfg="cfail3")]
985 #[rustc_metadata_dirty(cfg="cfail2")]
986 #[rustc_metadata_clean(cfg="cfail3")]
987 trait TraitAddSecondLifetimeBoundToLifetimeParameterOfTrait
<'a
: 'b
+ 'c
, 'b
, 'c
> { }
991 // Add second builtin bound to type parameter of trait ----------------------------
993 trait TraitAddSecondBuiltinBoundToTypeParameterOfTrait
<T
: Send
> { }
996 #[rustc_dirty(label="Hir", cfg="cfail2")]
997 #[rustc_clean(label="Hir", cfg="cfail3")]
998 #[rustc_metadata_dirty(cfg="cfail2")]
999 #[rustc_metadata_clean(cfg="cfail3")]
1000 trait TraitAddSecondBuiltinBoundToTypeParameterOfTrait
<T
: Send
+ Sync
> { }
1004 // --------------------------------------------------------------------------------
1005 struct ReferenceType0 {}
1006 struct ReferenceType1 {}
1010 // Add trait bound to type parameter of trait in where clause----------------------
1012 trait TraitAddTraitBoundToTypeParameterOfTraitWhere
<T
> { }
1015 #[rustc_dirty(label="Hir", cfg="cfail2")]
1016 #[rustc_clean(label="Hir", cfg="cfail3")]
1017 #[rustc_metadata_dirty(cfg="cfail2")]
1018 #[rustc_metadata_clean(cfg="cfail3")]
1019 trait TraitAddTraitBoundToTypeParameterOfTraitWhere
<T
> where T
: ReferencedTrait0 { }
1023 // Add lifetime bound to type parameter of trait in where clause-------------------
1025 trait TraitAddLifetimeBoundToTypeParameterOfTraitWhere
<'a
, T
> { }
1028 #[rustc_dirty(label="Hir", cfg="cfail2")]
1029 #[rustc_clean(label="Hir", cfg="cfail3")]
1030 #[rustc_metadata_dirty(cfg="cfail2")]
1031 #[rustc_metadata_clean(cfg="cfail3")]
1032 trait TraitAddLifetimeBoundToTypeParameterOfTraitWhere
<'a
, T
> where T
: 'a { }
1036 // Add lifetime bound to lifetime parameter of trait in where clause---------------
1038 trait TraitAddLifetimeBoundToLifetimeParameterOfTraitWhere
<'a
, 'b
> { }
1041 #[rustc_dirty(label="Hir", cfg="cfail2")]
1042 #[rustc_clean(label="Hir", cfg="cfail3")]
1043 #[rustc_metadata_dirty(cfg="cfail2")]
1044 #[rustc_metadata_clean(cfg="cfail3")]
1045 trait TraitAddLifetimeBoundToLifetimeParameterOfTraitWhere
<'a
, 'b
> where 'a
: 'b { }
1049 // Add builtin bound to type parameter of trait in where clause--------------------
1051 trait TraitAddBuiltinBoundToTypeParameterOfTraitWhere
<T
> { }
1054 #[rustc_dirty(label="Hir", cfg="cfail2")]
1055 #[rustc_clean(label="Hir", cfg="cfail3")]
1056 #[rustc_metadata_dirty(cfg="cfail2")]
1057 #[rustc_metadata_clean(cfg="cfail3")]
1058 trait TraitAddBuiltinBoundToTypeParameterOfTraitWhere
<T
> where T
: Send { }
1062 // Add second trait bound to type parameter of trait in where clause---------------
1064 trait TraitAddSecondTraitBoundToTypeParameterOfTraitWhere
<T
> where T
: ReferencedTrait0 { }
1067 #[rustc_dirty(label="Hir", cfg="cfail2")]
1068 #[rustc_clean(label="Hir", cfg="cfail3")]
1069 #[rustc_metadata_dirty(cfg="cfail2")]
1070 #[rustc_metadata_clean(cfg="cfail3")]
1071 trait TraitAddSecondTraitBoundToTypeParameterOfTraitWhere
<T
>
1072 where T
: ReferencedTrait0
+ ReferencedTrait1 { }
1076 // Add second lifetime bound to type parameter of trait in where clause------------
1078 trait TraitAddSecondLifetimeBoundToTypeParameterOfTraitWhere
<'a
, 'b
, T
> where T
: 'a { }
1081 #[rustc_dirty(label="Hir", cfg="cfail2")]
1082 #[rustc_clean(label="Hir", cfg="cfail3")]
1083 #[rustc_metadata_dirty(cfg="cfail2")]
1084 #[rustc_metadata_clean(cfg="cfail3")]
1085 trait TraitAddSecondLifetimeBoundToTypeParameterOfTraitWhere
<'a
, 'b
, T
> where T
: 'a
+ 'b { }
1089 // Add second lifetime bound to lifetime parameter of trait in where clause--------
1091 trait TraitAddSecondLifetimeBoundToLifetimeParameterOfTraitWhere
<'a
, 'b
, 'c
> where 'a
: 'b { }
1094 #[rustc_dirty(label="Hir", cfg="cfail2")]
1095 #[rustc_clean(label="Hir", cfg="cfail3")]
1096 #[rustc_metadata_dirty(cfg="cfail2")]
1097 #[rustc_metadata_clean(cfg="cfail3")]
1098 trait TraitAddSecondLifetimeBoundToLifetimeParameterOfTraitWhere
<'a
, 'b
, 'c
> where 'a
: 'b
+ 'c { }
1102 // Add second builtin bound to type parameter of trait in where clause-------------
1104 trait TraitAddSecondBuiltinBoundToTypeParameterOfTraitWhere
<T
> where T
: Send { }
1107 #[rustc_dirty(label="Hir", cfg="cfail2")]
1108 #[rustc_clean(label="Hir", cfg="cfail3")]
1109 #[rustc_metadata_dirty(cfg="cfail2")]
1110 #[rustc_metadata_clean(cfg="cfail3")]
1111 trait TraitAddSecondBuiltinBoundToTypeParameterOfTraitWhere
<T
> where T
: Send
+ Sync { }
1115 // EDIT: Some more cases ----------------------------------------------------------
1117 // Change return type of method indirectly by modifying a use statement------------
1118 mod change_return_type_of_method_indirectly_use
{
1120 use super::ReferenceType0
as ReturnType
;
1122 use super::ReferenceType1
as ReturnType
;
1124 #[rustc_clean(label="Hir", cfg="cfail2")]
1125 #[rustc_clean(label="Hir", cfg="cfail3")]
1126 #[rustc_metadata_dirty(cfg="cfail2")]
1127 #[rustc_metadata_clean(cfg="cfail3")]
1128 trait TraitChangeReturnType
{
1129 #[rustc_dirty(label="Hir", cfg="cfail2")]
1130 #[rustc_clean(label="Hir", cfg="cfail3")]
1131 #[rustc_metadata_dirty(cfg="cfail2")]
1132 #[rustc_metadata_clean(cfg="cfail3")]
1133 fn method() -> ReturnType
;
1139 // Change type of method parameter indirectly by modifying a use statement---------
1140 mod change_method_parameter_type_indirectly_by_use
{
1142 use super::ReferenceType0
as ArgType
;
1144 use super::ReferenceType1
as ArgType
;
1146 #[rustc_clean(label="Hir", cfg="cfail2")]
1147 #[rustc_clean(label="Hir", cfg="cfail3")]
1148 #[rustc_metadata_dirty(cfg="cfail2")]
1149 #[rustc_metadata_clean(cfg="cfail3")]
1150 trait TraitChangeArgType
{
1151 #[rustc_dirty(label="Hir", cfg="cfail2")]
1152 #[rustc_clean(label="Hir", cfg="cfail3")]
1153 #[rustc_metadata_dirty(cfg="cfail2")]
1154 #[rustc_metadata_clean(cfg="cfail3")]
1155 fn method(a
: ArgType
);
1161 // Change trait bound of method type parameter indirectly by modifying a use statement
1162 mod change_method_parameter_type_bound_indirectly_by_use
{
1164 use super::ReferencedTrait0
as Bound
;
1166 use super::ReferencedTrait1
as Bound
;
1168 #[rustc_clean(label="Hir", cfg="cfail2")]
1169 #[rustc_clean(label="Hir", cfg="cfail3")]
1170 #[rustc_metadata_dirty(cfg="cfail2")]
1171 #[rustc_metadata_clean(cfg="cfail3")]
1172 trait TraitChangeBoundOfMethodTypeParameter
{
1173 #[rustc_dirty(label="Hir", cfg="cfail2")]
1174 #[rustc_clean(label="Hir", cfg="cfail3")]
1175 #[rustc_metadata_dirty(cfg="cfail2")]
1176 #[rustc_metadata_clean(cfg="cfail3")]
1177 fn method
<T
: Bound
>(a
: T
);
1183 // Change trait bound of method type parameter in where clause indirectly
1184 // by modifying a use statement
1185 mod change_method_parameter_type_bound_indirectly_by_use_where
{
1187 use super::ReferencedTrait0
as Bound
;
1189 use super::ReferencedTrait1
as Bound
;
1191 #[rustc_clean(label="Hir", cfg="cfail2")]
1192 #[rustc_clean(label="Hir", cfg="cfail3")]
1193 #[rustc_metadata_dirty(cfg="cfail2")]
1194 #[rustc_metadata_clean(cfg="cfail3")]
1195 trait TraitChangeBoundOfMethodTypeParameterWhere
{
1196 #[rustc_dirty(label="Hir", cfg="cfail2")]
1197 #[rustc_clean(label="Hir", cfg="cfail3")]
1198 #[rustc_metadata_dirty(cfg="cfail2")]
1199 #[rustc_metadata_clean(cfg="cfail3")]
1200 fn method
<T
>(a
: T
) where T
: Bound
;
1206 // Change trait bound of trait type parameter indirectly by modifying a use statement
1207 mod change_method_type_parameter_bound_indirectly
{
1209 use super::ReferencedTrait0
as Bound
;
1211 use super::ReferencedTrait1
as Bound
;
1213 #[rustc_dirty(label="Hir", cfg="cfail2")]
1214 #[rustc_clean(label="Hir", cfg="cfail3")]
1215 #[rustc_metadata_dirty(cfg="cfail2")]
1216 #[rustc_metadata_clean(cfg="cfail3")]
1217 trait TraitChangeTraitBound
<T
: Bound
> {
1224 // Change trait bound of trait type parameter in where clause indirectly
1225 // by modifying a use statement
1226 mod change_method_type_parameter_bound_indirectly_where
{
1228 use super::ReferencedTrait0
as Bound
;
1230 use super::ReferencedTrait1
as Bound
;
1232 #[rustc_dirty(label="Hir", cfg="cfail2")]
1233 #[rustc_clean(label="Hir", cfg="cfail3")]
1234 #[rustc_metadata_dirty(cfg="cfail2")]
1235 #[rustc_metadata_clean(cfg="cfail3")]
1236 trait TraitChangeTraitBoundWhere
<T
> where T
: Bound
{