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