]> git.lizzy.rs Git - rust.git/blob - src/test/incremental/hashes/inherent_impls.rs
Rollup merge of #99746 - compiler-errors:more-trait-engine, r=jackh726
[rust.git] / src / test / incremental / hashes / inherent_impls.rs
1 // This test case tests the incremental compilation hash (ICH) implementation
2 // for let expressions.
3
4 // The general pattern followed here is: Change one thing between rev1 and rev2
5 // and make sure that the hash has changed, then change nothing between rev2 and
6 // rev3 and make sure that the hash has not changed.
7
8 // build-pass (FIXME(62277): could be check-pass?)
9 // revisions: cfail1 cfail2 cfail3 cfail4 cfail5 cfail6
10 // compile-flags: -Z query-dep-graph -O
11 // [cfail1]compile-flags: -Zincremental-ignore-spans
12 // [cfail2]compile-flags: -Zincremental-ignore-spans
13 // [cfail3]compile-flags: -Zincremental-ignore-spans
14 // [cfail4]compile-flags: -Zincremental-relative-spans
15 // [cfail5]compile-flags: -Zincremental-relative-spans
16 // [cfail6]compile-flags: -Zincremental-relative-spans
17
18
19 #![allow(warnings)]
20 #![feature(rustc_attrs)]
21 #![crate_type="rlib"]
22
23 pub struct Foo;
24
25 // Change Method Name -----------------------------------------------------------
26 #[cfg(any(cfail1,cfail4))]
27 impl Foo {
28     pub fn method_name() { }
29 }
30
31 #[cfg(not(any(cfail1,cfail4)))]
32 #[rustc_clean(cfg="cfail2", except="hir_owner,hir_owner_nodes,associated_item_def_ids")]
33 #[rustc_clean(cfg="cfail3")]
34 #[rustc_clean(cfg="cfail5", except="hir_owner,hir_owner_nodes,associated_item_def_ids")]
35 #[rustc_clean(cfg="cfail6")]
36 impl Foo {
37     #[rustc_clean(cfg="cfail3")]
38     #[rustc_clean(cfg="cfail6")]
39     pub fn method_name2() { }
40 }
41
42 // Change Method Body -----------------------------------------------------------
43 //
44 // This should affect the method itself, but not the impl.
45 #[cfg(any(cfail1,cfail4))]
46 impl Foo {
47     //--------------------------------------------------------------------------------------
48     //--------------------------
49     //--------------------------------------------------------------------------------------
50     //--------------------------
51     pub fn method_body() {
52         // -----------------------
53     }
54 }
55
56 #[cfg(not(any(cfail1,cfail4)))]
57 #[rustc_clean(cfg="cfail2")]
58 #[rustc_clean(cfg="cfail3")]
59 #[rustc_clean(cfg="cfail5")]
60 #[rustc_clean(cfg="cfail6")]
61 impl Foo {
62     #[rustc_clean(cfg="cfail2", except="hir_owner_nodes,optimized_mir,promoted_mir,typeck")]
63     #[rustc_clean(cfg="cfail3")]
64     #[rustc_clean(cfg="cfail5", except="hir_owner_nodes,optimized_mir,promoted_mir,typeck")]
65     #[rustc_clean(cfg="cfail6")]
66     pub fn method_body() {
67         println!("Hello, world!");
68     }
69 }
70
71
72 // Change Method Body (inlined) ------------------------------------------------
73 //
74 // This should affect the method itself, but not the impl.
75 #[cfg(any(cfail1,cfail4))]
76 impl Foo {
77     //------------
78     //---------------
79     //------------------------------------------------------------
80     //
81     //--------------------------
82     //------------
83     //---------------
84     //------------------------------------------------------------
85     //
86     //--------------------------
87     #[inline]
88     pub fn method_body_inlined() {
89         // -----------------------
90     }
91 }
92
93 #[cfg(not(any(cfail1,cfail4)))]
94 #[rustc_clean(cfg="cfail2")]
95 #[rustc_clean(cfg="cfail3")]
96 #[rustc_clean(cfg="cfail5")]
97 #[rustc_clean(cfg="cfail6")]
98 impl Foo {
99     #[rustc_clean(
100         cfg="cfail2",
101         except="hir_owner_nodes,optimized_mir,promoted_mir,typeck"
102     )]
103     #[rustc_clean(cfg="cfail3")]
104     #[rustc_clean(
105         cfg="cfail5",
106         except="hir_owner_nodes,optimized_mir,promoted_mir,typeck"
107     )]
108     #[rustc_clean(cfg="cfail6")]
109     #[inline]
110     pub fn method_body_inlined() {
111         println!("Hello, world!");
112     }
113 }
114
115
116 // Change Method Privacy -------------------------------------------------------
117 #[cfg(any(cfail1,cfail4))]
118 impl Foo {
119     //--------------------------
120     //--------------------------
121     //--------------------------------------------------------------
122     //--------------------------
123     pub fn method_privacy() { }
124 }
125
126 #[cfg(not(any(cfail1,cfail4)))]
127 #[rustc_clean(cfg="cfail2")]
128 #[rustc_clean(cfg="cfail3")]
129 #[rustc_clean(cfg="cfail5")]
130 #[rustc_clean(cfg="cfail6")]
131 impl Foo {
132     #[rustc_clean(cfg="cfail2")]
133     #[rustc_clean(cfg="cfail3")]
134     #[rustc_clean(cfg="cfail5", except="hir_owner,hir_owner_nodes")]
135     #[rustc_clean(cfg="cfail6")]
136     fn     method_privacy() { }
137 }
138
139 // Change Method Selfness -----------------------------------------------------------
140 #[cfg(any(cfail1,cfail4))]
141 impl Foo {
142     //------------
143     //---------------
144     //---------------------------------------------------------------------------------------------
145     //
146     //--------------------------
147     //------------
148     //---------------
149     //---------------------------------------------------------------------------------------------
150     //
151     //--------------------------
152     pub fn method_selfness() { }
153 }
154
155 #[cfg(not(any(cfail1,cfail4)))]
156 #[rustc_clean(cfg="cfail2", except="hir_owner,hir_owner_nodes")]
157 #[rustc_clean(cfg="cfail3")]
158 #[rustc_clean(cfg="cfail5", except="hir_owner,hir_owner_nodes")]
159 #[rustc_clean(cfg="cfail6")]
160 impl Foo {
161     #[rustc_clean(
162         cfg="cfail2",
163         except="hir_owner,hir_owner_nodes,fn_sig,generics_of,typeck,associated_item,optimized_mir",
164     )]
165     #[rustc_clean(cfg="cfail3")]
166     #[rustc_clean(
167         cfg="cfail5",
168         except="hir_owner,hir_owner_nodes,fn_sig,generics_of,typeck,associated_item,optimized_mir",
169     )]
170     #[rustc_clean(cfg="cfail6")]
171     pub fn method_selfness(&self) { }
172 }
173
174 // Change Method Selfmutness ---------------------------------------------------
175 #[cfg(any(cfail1,cfail4))]
176 impl Foo {
177     //------------------------------------------------------------------------------------------
178     //--------------------------
179     //------------------------------------------------------------------------------------------
180     //--------------------------
181     pub fn method_selfmutness(&    self) { }
182 }
183
184 #[cfg(not(any(cfail1,cfail4)))]
185 #[rustc_clean(cfg="cfail2")]
186 #[rustc_clean(cfg="cfail3")]
187 #[rustc_clean(cfg="cfail5")]
188 #[rustc_clean(cfg="cfail6")]
189 impl Foo {
190     #[rustc_clean(cfg="cfail2", except="hir_owner,hir_owner_nodes,fn_sig,typeck,optimized_mir")]
191     #[rustc_clean(cfg="cfail3")]
192     #[rustc_clean(cfg="cfail5", except="hir_owner,hir_owner_nodes,fn_sig,typeck,optimized_mir")]
193     #[rustc_clean(cfg="cfail6")]
194     pub fn method_selfmutness(&mut self) { }
195 }
196
197
198
199 // Add Method To Impl ----------------------------------------------------------
200 #[cfg(any(cfail1,cfail4))]
201 impl Foo {
202     pub fn add_method_to_impl1(&self) { }
203 }
204
205 #[cfg(not(any(cfail1,cfail4)))]
206 #[rustc_clean(cfg="cfail2", except="hir_owner,hir_owner_nodes,associated_item_def_ids")]
207 #[rustc_clean(cfg="cfail3")]
208 #[rustc_clean(cfg="cfail5", except="hir_owner,hir_owner_nodes,associated_item_def_ids")]
209 #[rustc_clean(cfg="cfail6")]
210 impl Foo {
211     #[rustc_clean(cfg="cfail2")]
212     #[rustc_clean(cfg="cfail3")]
213     #[rustc_clean(cfg="cfail5")]
214     #[rustc_clean(cfg="cfail6")]
215     pub fn add_method_to_impl1(&self) { }
216
217     #[rustc_clean(cfg="cfail3")]
218     #[rustc_clean(cfg="cfail6")]
219     pub fn add_method_to_impl2(&self) { }
220 }
221
222
223
224 // Add Method Parameter --------------------------------------------------------
225 #[cfg(any(cfail1,cfail4))]
226 impl Foo {
227     //------------------------------------------------------------------------------------------
228     //--------------------------
229     //------------------------------------------------------------------------------------------
230     //--------------------------
231     pub fn add_method_parameter(&self        ) { }
232 }
233
234 #[cfg(not(any(cfail1,cfail4)))]
235 #[rustc_clean(cfg="cfail2")]
236 #[rustc_clean(cfg="cfail3")]
237 #[rustc_clean(cfg="cfail5")]
238 #[rustc_clean(cfg="cfail6")]
239 impl Foo {
240     #[rustc_clean(cfg="cfail2", except="hir_owner,hir_owner_nodes,fn_sig,typeck,optimized_mir")]
241     #[rustc_clean(cfg="cfail3")]
242     #[rustc_clean(cfg="cfail5", except="hir_owner,hir_owner_nodes,fn_sig,typeck,optimized_mir")]
243     #[rustc_clean(cfg="cfail6")]
244     pub fn add_method_parameter(&self, _: i32) { }
245 }
246
247
248
249 // Change Method Parameter Name ------------------------------------------------
250 #[cfg(any(cfail1,cfail4))]
251 impl Foo {
252     //------------------------------------------------------------------
253     //--------------------------
254     //------------------------------------------------------------------
255     //--------------------------
256     pub fn change_method_parameter_name(&self, a: i64) { }
257 }
258
259 #[cfg(not(any(cfail1,cfail4)))]
260 #[rustc_clean(cfg="cfail2")]
261 #[rustc_clean(cfg="cfail3")]
262 #[rustc_clean(cfg="cfail5")]
263 #[rustc_clean(cfg="cfail6")]
264 impl Foo {
265     #[rustc_clean(cfg="cfail2", except="hir_owner_nodes,optimized_mir")]
266     #[rustc_clean(cfg="cfail3")]
267     #[rustc_clean(cfg="cfail5", except="hir_owner_nodes,optimized_mir")]
268     #[rustc_clean(cfg="cfail6")]
269     pub fn change_method_parameter_name(&self, b: i64) { }
270 }
271
272
273
274 // Change Method Return Type ---------------------------------------------------
275 #[cfg(any(cfail1,cfail4))]
276 impl Foo {
277     //------------------------------------------------------------------------------------------
278     //--------------------------
279     //------------------------------------------------------------------------------------------
280     //--------------------------
281     pub fn change_method_return_type(&self) -> u16 { 0 }
282 }
283
284 #[cfg(not(any(cfail1,cfail4)))]
285 #[rustc_clean(cfg="cfail2")]
286 #[rustc_clean(cfg="cfail3")]
287 #[rustc_clean(cfg="cfail5")]
288 #[rustc_clean(cfg="cfail6")]
289 impl Foo {
290     #[rustc_clean(cfg="cfail2", except="hir_owner,hir_owner_nodes,fn_sig,optimized_mir,typeck")]
291     #[rustc_clean(cfg="cfail3")]
292     #[rustc_clean(cfg="cfail5", except="hir_owner,hir_owner_nodes,fn_sig,optimized_mir,typeck")]
293     #[rustc_clean(cfg="cfail6")]
294     pub fn change_method_return_type(&self) -> u32 { 0 }
295 }
296
297
298
299 // Make Method #[inline] -------------------------------------------------------
300 #[cfg(any(cfail1,cfail4))]
301 impl Foo {
302     //--------------------------
303     //--------------------------
304     //--------------------------
305     //--------------------------
306     //-------
307     pub fn make_method_inline(&self) -> u8 { 0 }
308 }
309
310 #[cfg(not(any(cfail1,cfail4)))]
311 #[rustc_clean(cfg="cfail2")]
312 #[rustc_clean(cfg="cfail3")]
313 #[rustc_clean(cfg="cfail5")]
314 #[rustc_clean(cfg="cfail6")]
315 impl Foo {
316     #[rustc_clean(cfg="cfail2")]
317     #[rustc_clean(cfg="cfail3")]
318     #[rustc_clean(cfg="cfail5")]
319     #[rustc_clean(cfg="cfail6")]
320     #[inline]
321     pub fn make_method_inline(&self) -> u8 { 0 }
322 }
323
324
325
326 //  Change order of parameters -------------------------------------------------
327 #[cfg(any(cfail1,cfail4))]
328 impl Foo {
329     //------------------------------------------------------------------
330     //--------------------------
331     //------------------------------------------------------------------
332     //--------------------------
333     pub fn change_method_parameter_order(&self, a: i64, b: i64) { }
334 }
335
336 #[cfg(not(any(cfail1,cfail4)))]
337 #[rustc_clean(cfg="cfail2")]
338 #[rustc_clean(cfg="cfail3")]
339 #[rustc_clean(cfg="cfail5")]
340 #[rustc_clean(cfg="cfail6")]
341 impl Foo {
342     #[rustc_clean(cfg="cfail2", except="hir_owner_nodes,optimized_mir")]
343     #[rustc_clean(cfg="cfail3")]
344     #[rustc_clean(cfg="cfail5", except="hir_owner_nodes,optimized_mir")]
345     #[rustc_clean(cfg="cfail6")]
346     pub fn change_method_parameter_order(&self, b: i64, a: i64) { }
347 }
348
349
350
351 // Make method unsafe ----------------------------------------------------------
352 #[cfg(any(cfail1,cfail4))]
353 impl Foo {
354     //------------------------------------------------------------------------------------------
355     //--------------------------
356     //------------------------------------------------------------------------------------------
357     //--------------------------
358     pub        fn make_method_unsafe(&self) { }
359 }
360
361 #[cfg(not(any(cfail1,cfail4)))]
362 #[rustc_clean(cfg="cfail2")]
363 #[rustc_clean(cfg="cfail3")]
364 #[rustc_clean(cfg="cfail5")]
365 #[rustc_clean(cfg="cfail6")]
366 impl Foo {
367     #[rustc_clean(cfg="cfail2", except="hir_owner,hir_owner_nodes,fn_sig,typeck,optimized_mir")]
368     #[rustc_clean(cfg="cfail3")]
369     #[rustc_clean(cfg="cfail5", except="hir_owner,hir_owner_nodes,fn_sig,typeck,optimized_mir")]
370     #[rustc_clean(cfg="cfail6")]
371     pub unsafe fn make_method_unsafe(&self) { }
372 }
373
374
375
376 // Make method extern ----------------------------------------------------------
377 #[cfg(any(cfail1,cfail4))]
378 impl Foo {
379     //----------------------------------------------------------------------------
380     //--------------------------
381     //----------------------------------------------------------------------------
382     //--------------------------
383     pub            fn make_method_extern(&self) { }
384 }
385
386 #[cfg(not(any(cfail1,cfail4)))]
387 #[rustc_clean(cfg="cfail2")]
388 #[rustc_clean(cfg="cfail3")]
389 #[rustc_clean(cfg="cfail5")]
390 #[rustc_clean(cfg="cfail6")]
391 impl Foo {
392     #[rustc_clean(cfg="cfail2", except="hir_owner,hir_owner_nodes,fn_sig,typeck")]
393     #[rustc_clean(cfg="cfail3")]
394     #[rustc_clean(cfg="cfail5", except="hir_owner,hir_owner_nodes,fn_sig,typeck")]
395     #[rustc_clean(cfg="cfail6")]
396     pub extern "C" fn make_method_extern(&self) { }
397 }
398
399
400
401 // Change method calling convention --------------------------------------------
402 #[cfg(any(cfail1,cfail4))]
403 impl Foo {
404     //----------------------------------------------------------------------------
405     //--------------------------
406     //----------------------------------------------------------------------------
407     //--------------------------
408     pub extern "C"      fn change_method_calling_convention(&self) { }
409 }
410
411 #[cfg(not(any(cfail1,cfail4)))]
412 #[rustc_clean(cfg="cfail2")]
413 #[rustc_clean(cfg="cfail3")]
414 #[rustc_clean(cfg="cfail5")]
415 #[rustc_clean(cfg="cfail6")]
416 impl Foo {
417     #[rustc_clean(cfg="cfail2", except="hir_owner,hir_owner_nodes,fn_sig,typeck")]
418     #[rustc_clean(cfg="cfail3")]
419     #[rustc_clean(cfg="cfail5", except="hir_owner,hir_owner_nodes,fn_sig,typeck")]
420     #[rustc_clean(cfg="cfail6")]
421     pub extern "system" fn change_method_calling_convention(&self) { }
422 }
423
424
425
426 // Add Lifetime Parameter to Method --------------------------------------------
427 #[cfg(any(cfail1,cfail4))]
428 impl Foo {
429     // -----------------------------------------------------
430     // ---------------------------------------------------------
431     // ----------------------------------------------------------
432     // -------------------------------------------------------
433     // -------------------------------------------------------
434     // --------------------------------------------------------
435     // ----------------------------------------------------------
436     // -----------------------------------------------------------
437     // ----------------------------------------------------------
438     // --------------------------------------------------------------------
439     // -------------------------
440     // --------------------------------------------------------------------------------
441     // -------------------------
442     pub fn add_lifetime_parameter_to_method    (&self) { }
443 }
444
445 #[cfg(not(any(cfail1,cfail4)))]
446 #[rustc_clean(cfg="cfail2")]
447 #[rustc_clean(cfg="cfail3")]
448 #[rustc_clean(cfg="cfail5")]
449 #[rustc_clean(cfg="cfail6")]
450 impl Foo {
451     // Warning: Note that `typeck` are coming up clean here.
452     // The addition or removal of lifetime parameters that don't
453     // appear in the arguments or fn body in any way does not, in
454     // fact, affect the `typeck` in any semantic way (at least
455     // as of this writing). **However,** altering the order of
456     // lowering **can** cause it appear to affect the `typeck`:
457     // if we lower generics before the body, then the `HirId` for
458     // things in the body will be affected. So if you start to see
459     // `typeck` appear dirty, that might be the cause. -nmatsakis
460     #[rustc_clean(cfg="cfail2", except="hir_owner,hir_owner_nodes,fn_sig")]
461     #[rustc_clean(cfg="cfail3")]
462     #[rustc_clean(cfg="cfail5", except="hir_owner,hir_owner_nodes,fn_sig,generics_of")]
463     #[rustc_clean(cfg="cfail6")]
464     pub fn add_lifetime_parameter_to_method<'a>(&self) { }
465 }
466
467
468
469 // Add Type Parameter To Method ------------------------------------------------
470 #[cfg(any(cfail1,cfail4))]
471 impl Foo {
472     // -----------------------------------------------------
473     // ---------------------------------------------------------------
474     // -------------------------------------------------------------
475     // -----------------------------------------------------
476     // -------------------------------------------------------------
477     // ---------------------------------------------------
478     // ------------------------------------------------------------
479     // ------------------------------------------------------
480     // -------------------------------------------------
481     // -----------
482     // --------------
483     // ----------------------------------------------------------------------
484     //
485     // -------------------------
486     // -----------
487     // --------------
488     // ----------------------------------------------------------------------
489     //
490     // -------------------------
491     pub fn add_type_parameter_to_method   (&self) { }
492 }
493
494 #[cfg(not(any(cfail1,cfail4)))]
495 #[rustc_clean(cfg="cfail2")]
496 #[rustc_clean(cfg="cfail3")]
497 #[rustc_clean(cfg="cfail5")]
498 #[rustc_clean(cfg="cfail6")]
499 impl Foo {
500     // Warning: Note that `typeck` are coming up clean here.
501     // The addition or removal of type parameters that don't appear in
502     // the arguments or fn body in any way does not, in fact, affect
503     // the `typeck` in any semantic way (at least as of this
504     // writing). **However,** altering the order of lowering **can**
505     // cause it appear to affect the `typeck`: if we lower
506     // generics before the body, then the `HirId` for things in the
507     // body will be affected. So if you start to see `typeck`
508     // appear dirty, that might be the cause. -nmatsakis
509     #[rustc_clean(
510         cfg="cfail2",
511         except="hir_owner,hir_owner_nodes,generics_of,predicates_of,type_of",
512     )]
513     #[rustc_clean(cfg="cfail3")]
514     #[rustc_clean(
515         cfg="cfail5",
516         except="hir_owner,hir_owner_nodes,generics_of,predicates_of,type_of",
517     )]
518     #[rustc_clean(cfg="cfail6")]
519     pub fn add_type_parameter_to_method<T>(&self) { }
520 }
521
522
523
524 // Add Lifetime Bound to Lifetime Parameter of Method --------------------------
525 #[cfg(any(cfail1,cfail4))]
526 impl Foo {
527     //------------
528     //---------------
529     //-----------------------------------------------------------------------------
530     //
531     //--------------------------
532     //------------
533     //---------------
534     //-----------------------------------------------------------------------------
535     //
536     //--------------------------
537     pub fn add_lifetime_bound_to_lifetime_param_of_method<'a, 'b    >(&self) { }
538 }
539
540 #[cfg(not(any(cfail1,cfail4)))]
541 #[rustc_clean(cfg="cfail2")]
542 #[rustc_clean(cfg="cfail3")]
543 #[rustc_clean(cfg="cfail5")]
544 #[rustc_clean(cfg="cfail6")]
545 impl Foo {
546     #[rustc_clean(
547         cfg="cfail2",
548         except="hir_owner,hir_owner_nodes,generics_of,predicates_of,type_of,fn_sig"
549     )]
550     #[rustc_clean(cfg="cfail3")]
551     #[rustc_clean(
552         cfg="cfail5",
553         except="hir_owner,hir_owner_nodes,generics_of,predicates_of,type_of,fn_sig"
554     )]
555     #[rustc_clean(cfg="cfail6")]
556     pub fn add_lifetime_bound_to_lifetime_param_of_method<'a, 'b: 'a>(&self) { }
557 }
558
559
560
561 // Add Lifetime Bound to Type Parameter of Method ------------------------------
562 #[cfg(any(cfail1,cfail4))]
563 impl Foo {
564     // -----------------------------------------------------
565     // ----------------------------------------------------------
566     // -------------------------------------------------------------
567     // -------------------------------------------------
568     // -------------------------------------------------------------
569     // ---------------------------------------------------
570     // ------------------------------------------------------------
571     // ------------------------------------------------------
572     // -------------------------------------------------
573     // -----------
574     // --------------
575     // ----------------------------------------------------------------------------
576     //
577     // -------------------------
578     // -----------
579     // --------------
580     // ----------------------------------------------------------------------------
581     //
582     // -------------------------
583     pub fn add_lifetime_bound_to_type_param_of_method<'a, T    >(&self) { }
584 }
585
586 #[cfg(not(any(cfail1,cfail4)))]
587 #[rustc_clean(cfg="cfail2")]
588 #[rustc_clean(cfg="cfail3")]
589 #[rustc_clean(cfg="cfail5")]
590 #[rustc_clean(cfg="cfail6")]
591 impl Foo {
592     // Warning: Note that `typeck` are coming up clean here.
593     // The addition or removal of bounds that don't appear in the
594     // arguments or fn body in any way does not, in fact, affect the
595     // `typeck` in any semantic way (at least as of this
596     // writing). **However,** altering the order of lowering **can**
597     // cause it appear to affect the `typeck`: if we lower
598     // generics before the body, then the `HirId` for things in the
599     // body will be affected. So if you start to see `typeck`
600     // appear dirty, that might be the cause. -nmatsakis
601     #[rustc_clean(
602         cfg="cfail2",
603         except="hir_owner,hir_owner_nodes,generics_of,predicates_of,type_of,fn_sig"
604     )]
605     #[rustc_clean(cfg="cfail3")]
606     #[rustc_clean(
607         cfg="cfail5",
608         except="hir_owner,hir_owner_nodes,generics_of,predicates_of,type_of,fn_sig"
609     )]
610     #[rustc_clean(cfg="cfail6")]
611     pub fn add_lifetime_bound_to_type_param_of_method<'a, T: 'a>(&self) { }
612 }
613
614
615
616 // Add Trait Bound to Type Parameter of Method ------------------------------
617 #[cfg(any(cfail1,cfail4))]
618 impl Foo {
619     // -----------------------------------------------------
620     // ----------------------------------------------------------
621     // -------------------------------------------------------------
622     // -------------------------------------------------
623     // -------------------------------------------------------------
624     // ---------------------------------------------------
625     // ------------------------------------------------------------
626     // ------------------------------------------------------
627     // -------------------------------------------------
628     // ---------------------------------------------------------------------------
629     // -------------------------
630     // ---------------------------------------------------------------------------
631     // -------------------------
632     pub fn add_trait_bound_to_type_param_of_method<T       >(&self) { }
633 }
634
635 #[cfg(not(any(cfail1,cfail4)))]
636 #[rustc_clean(cfg="cfail2")]
637 #[rustc_clean(cfg="cfail3")]
638 #[rustc_clean(cfg="cfail5")]
639 #[rustc_clean(cfg="cfail6")]
640 impl Foo {
641     // Warning: Note that `typeck` are coming up clean here.
642     // The addition or removal of bounds that don't appear in the
643     // arguments or fn body in any way does not, in fact, affect the
644     // `typeck` in any semantic way (at least as of this
645     // writing). **However,** altering the order of lowering **can**
646     // cause it appear to affect the `typeck`: if we lower
647     // generics before the body, then the `HirId` for things in the
648     // body will be affected. So if you start to see `typeck`
649     // appear dirty, that might be the cause. -nmatsakis
650     #[rustc_clean(cfg="cfail2", except="hir_owner,hir_owner_nodes,predicates_of")]
651     #[rustc_clean(cfg="cfail3")]
652     #[rustc_clean(cfg="cfail5", except="hir_owner,hir_owner_nodes,predicates_of")]
653     #[rustc_clean(cfg="cfail6")]
654     pub fn add_trait_bound_to_type_param_of_method<T: Clone>(&self) { }
655 }
656
657
658
659 // Add #[no_mangle] to Method --------------------------------------------------
660 #[cfg(any(cfail1,cfail4))]
661 impl Foo {
662     //--------------------------
663     //--------------------------
664     //--------------------------
665     //--------------------------
666     //----------
667     pub fn add_no_mangle_to_method(&self) { }
668 }
669
670 #[cfg(not(any(cfail1,cfail4)))]
671 #[rustc_clean(cfg="cfail2")]
672 #[rustc_clean(cfg="cfail3")]
673 #[rustc_clean(cfg="cfail5")]
674 #[rustc_clean(cfg="cfail6")]
675 impl Foo {
676     #[rustc_clean(cfg="cfail2")]
677     #[rustc_clean(cfg="cfail3")]
678     #[rustc_clean(cfg="cfail5")]
679     #[rustc_clean(cfg="cfail6")]
680     #[no_mangle]
681     pub fn add_no_mangle_to_method(&self) { }
682 }
683
684
685
686 struct Bar<T>(T);
687
688 // Add Type Parameter To Impl --------------------------------------------------
689 #[cfg(any(cfail1,cfail4))]
690 impl Bar<u32> {
691     pub fn add_type_parameter_to_impl(&self) { }
692 }
693
694 #[cfg(not(any(cfail1,cfail4)))]
695 #[rustc_clean(cfg="cfail2", except="hir_owner,hir_owner_nodes,generics_of")]
696 #[rustc_clean(cfg="cfail3")]
697 #[rustc_clean(cfg="cfail5", except="hir_owner,hir_owner_nodes,generics_of")]
698 #[rustc_clean(cfg="cfail6")]
699 impl<T> Bar<T> {
700     #[rustc_clean(
701         cfg="cfail2",
702         except="generics_of,fn_sig,typeck,type_of,optimized_mir"
703     )]
704     #[rustc_clean(cfg="cfail3")]
705     #[rustc_clean(
706         cfg="cfail5",
707         except="generics_of,fn_sig,typeck,type_of,optimized_mir"
708     )]
709     #[rustc_clean(cfg="cfail6")]
710     pub fn add_type_parameter_to_impl(&self) { }
711 }
712
713
714
715 // Change Self Type of Impl ----------------------------------------------------
716 #[cfg(any(cfail1,cfail4))]
717 impl Bar<u32> {
718     pub fn change_impl_self_type(&self) { }
719 }
720
721 #[cfg(not(any(cfail1,cfail4)))]
722 #[rustc_clean(cfg="cfail2", except="hir_owner,hir_owner_nodes")]
723 #[rustc_clean(cfg="cfail3")]
724 #[rustc_clean(cfg="cfail5", except="hir_owner,hir_owner_nodes")]
725 #[rustc_clean(cfg="cfail6")]
726 impl Bar<u64> {
727     #[rustc_clean(cfg="cfail2", except="fn_sig,optimized_mir,typeck")]
728     #[rustc_clean(cfg="cfail3")]
729     #[rustc_clean(cfg="cfail5", except="fn_sig,optimized_mir,typeck")]
730     #[rustc_clean(cfg="cfail6")]
731     pub fn change_impl_self_type(&self) { }
732 }
733
734
735
736 // Add Lifetime Bound to Impl --------------------------------------------------
737 #[cfg(any(cfail1,cfail4))]
738 impl<T> Bar<T> {
739     pub fn add_lifetime_bound_to_impl_parameter(&self) { }
740 }
741
742 #[cfg(not(any(cfail1,cfail4)))]
743 #[rustc_clean(cfg="cfail2", except="hir_owner,hir_owner_nodes")]
744 #[rustc_clean(cfg="cfail3")]
745 #[rustc_clean(cfg="cfail5", except="hir_owner,hir_owner_nodes")]
746 #[rustc_clean(cfg="cfail6")]
747 impl<T: 'static> Bar<T> {
748     #[rustc_clean(cfg="cfail2")]
749     #[rustc_clean(cfg="cfail3")]
750     #[rustc_clean(cfg="cfail5")]
751     #[rustc_clean(cfg="cfail6")]
752     pub fn add_lifetime_bound_to_impl_parameter(&self) { }
753 }
754
755
756
757 // Add Trait Bound to Impl Parameter -------------------------------------------
758 #[cfg(any(cfail1,cfail4))]
759 impl<T> Bar<T> {
760     pub fn add_trait_bound_to_impl_parameter(&self) { }
761 }
762
763 #[cfg(not(any(cfail1,cfail4)))]
764 #[rustc_clean(cfg="cfail2", except="hir_owner,hir_owner_nodes")]
765 #[rustc_clean(cfg="cfail3")]
766 #[rustc_clean(cfg="cfail5", except="hir_owner,hir_owner_nodes")]
767 #[rustc_clean(cfg="cfail6")]
768 impl<T: Clone> Bar<T> {
769     #[rustc_clean(cfg="cfail2")]
770     #[rustc_clean(cfg="cfail3")]
771     #[rustc_clean(cfg="cfail5")]
772     #[rustc_clean(cfg="cfail6")]
773     pub fn add_trait_bound_to_impl_parameter(&self) { }
774 }
775
776
777 // Force instantiation of some fns so we can check their hash.
778 pub fn instantiation_root() {
779     Foo::method_privacy();
780
781     #[cfg(any(cfail1,cfail4))]
782     {
783         Bar(0u32).change_impl_self_type();
784     }
785
786     #[cfg(not(any(cfail1,cfail4)))]
787     {
788         Bar(0u64).change_impl_self_type();
789     }
790 }