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