1 // This test case tests the incremental compilation hash (ICH) implementation
2 // for let expressions.
4 // The general pattern followed here is: Change one thing between rev1 and rev2
5 // and make sure that the hash has changed, then change nothing between rev2 and
6 // rev3 and make sure that the hash has not changed.
8 // build-pass (FIXME(62277): could be check-pass?)
9 // revisions: cfail1 cfail2 cfail3
10 // compile-flags: -Z query-dep-graph -Zincremental-ignore-spans
14 #![feature(rustc_attrs)]
19 // Change Method Name -----------------------------------------------------------
22 pub fn method_name() { }
26 #[rustc_clean(cfg="cfail2", except="Hir,HirBody,associated_item_def_ids")]
27 #[rustc_clean(cfg="cfail3")]
29 #[rustc_clean(cfg="cfail3")]
30 pub fn method_name2() { }
33 // Change Method Body -----------------------------------------------------------
35 // This should affect the method itself, but not the impl.
38 pub fn method_body() { }
42 #[rustc_clean(cfg="cfail2")]
43 #[rustc_clean(cfg="cfail3")]
47 except
="HirBody,optimized_mir,promoted_mir,mir_built,typeck_tables_of"
49 #[rustc_clean(cfg="cfail3")]
50 pub fn method_body() {
51 println
!("Hello, world!");
56 // Change Method Body (inlined) ------------------------------------------------
58 // This should affect the method itself, but not the impl.
62 pub fn method_body_inlined() { }
66 #[rustc_clean(cfg="cfail2")]
67 #[rustc_clean(cfg="cfail3")]
71 except
="HirBody,optimized_mir,promoted_mir,mir_built,typeck_tables_of"
73 #[rustc_clean(cfg="cfail3")]
75 pub fn method_body_inlined() {
76 println
!("Hello, world!");
81 // Change Method Privacy -------------------------------------------------------
84 pub fn method_privacy() { }
88 #[rustc_clean(cfg="cfail2", except="Hir,HirBody")]
89 #[rustc_clean(cfg="cfail3")]
91 #[rustc_clean(cfg="cfail2", except="associated_item,Hir,HirBody")]
92 #[rustc_clean(cfg="cfail3")]
93 fn method_privacy() { }
96 // Change Method Selfness -----------------------------------------------------------
99 pub fn method_selfness() { }
103 #[rustc_clean(cfg="cfail2", except="Hir,HirBody")]
104 #[rustc_clean(cfg="cfail3")]
106 #[rustc_dirty(cfg="cfail2", except="type_of,predicates_of,promoted_mir")]
107 #[rustc_clean(cfg="cfail3")]
108 pub fn method_selfness(&self) { }
111 // Change Method Selfmutness ---------------------------------------------------
114 pub fn method_selfmutness(&self) { }
118 #[rustc_clean(cfg="cfail2")]
119 #[rustc_clean(cfg="cfail3")]
123 except
="Hir,HirBody,fn_sig,typeck_tables_of,optimized_mir,mir_built"
125 #[rustc_clean(cfg="cfail3")]
126 pub fn method_selfmutness(&mut self) { }
131 // Add Method To Impl ----------------------------------------------------------
134 pub fn add_method_to_impl1(&self) { }
138 #[rustc_clean(cfg="cfail2", except="Hir,HirBody,associated_item_def_ids")]
139 #[rustc_clean(cfg="cfail3")]
141 #[rustc_clean(cfg="cfail2")]
142 #[rustc_clean(cfg="cfail3")]
143 pub fn add_method_to_impl1(&self) { }
145 #[rustc_clean(cfg="cfail3")]
146 pub fn add_method_to_impl2(&self) { }
151 // Add Method Parameter --------------------------------------------------------
154 pub fn add_method_parameter(&self) { }
158 #[rustc_clean(cfg="cfail2")]
159 #[rustc_clean(cfg="cfail3")]
163 except
="Hir,HirBody,fn_sig,typeck_tables_of,optimized_mir,mir_built"
165 #[rustc_clean(cfg="cfail3")]
166 pub fn add_method_parameter(&self, _
: i32) { }
171 // Change Method Parameter Name ------------------------------------------------
174 pub fn change_method_parameter_name(&self, a
: i64) { }
178 #[rustc_clean(cfg="cfail2")]
179 #[rustc_clean(cfg="cfail3")]
181 #[rustc_clean(cfg="cfail2", except="HirBody,optimized_mir,mir_built")]
182 #[rustc_clean(cfg="cfail3")]
183 pub fn change_method_parameter_name(&self, b
: i64) { }
188 // Change Method Return Type ---------------------------------------------------
191 pub fn change_method_return_type(&self) -> u16 { 0 }
195 #[rustc_clean(cfg="cfail2")]
196 #[rustc_clean(cfg="cfail3")]
200 except
="Hir,HirBody,fn_sig,optimized_mir,mir_built,typeck_tables_of")]
201 #[rustc_clean(cfg="cfail3")]
202 pub fn change_method_return_type(&self) -> u8 { 0 }
207 // Make Method #[inline] -------------------------------------------------------
210 pub fn make_method_inline(&self) -> u8 { 0 }
214 #[rustc_clean(cfg="cfail2")]
215 #[rustc_clean(cfg="cfail3")]
217 #[rustc_clean(cfg="cfail2", except="Hir,HirBody")]
218 #[rustc_clean(cfg="cfail3")]
220 pub fn make_method_inline(&self) -> u8 { 0 }
225 // Change order of parameters -------------------------------------------------
228 pub fn change_method_parameter_order(&self, a
: i64, b
: i64) { }
232 #[rustc_clean(cfg="cfail2")]
233 #[rustc_clean(cfg="cfail3")]
235 #[rustc_clean(cfg="cfail2", except="HirBody,optimized_mir,mir_built")]
236 #[rustc_clean(cfg="cfail3")]
237 pub fn change_method_parameter_order(&self, b
: i64, a
: i64) { }
242 // Make method unsafe ----------------------------------------------------------
245 pub fn make_method_unsafe(&self) { }
249 #[rustc_clean(cfg="cfail2")]
250 #[rustc_clean(cfg="cfail3")]
254 except
="Hir,HirBody,fn_sig,typeck_tables_of,optimized_mir,mir_built"
256 #[rustc_clean(cfg="cfail3")]
257 pub unsafe fn make_method_unsafe(&self) { }
262 // Make method extern ----------------------------------------------------------
265 pub fn make_method_extern(&self) { }
269 #[rustc_clean(cfg="cfail2")]
270 #[rustc_clean(cfg="cfail3")]
272 #[rustc_clean(cfg="cfail2", except="Hir,HirBody,fn_sig,typeck_tables_of")]
273 #[rustc_clean(cfg="cfail3")]
274 pub extern fn make_method_extern(&self) { }
279 // Change method calling convention --------------------------------------------
282 pub extern "C" fn change_method_calling_convention(&self) { }
286 #[rustc_clean(cfg="cfail2")]
287 #[rustc_clean(cfg="cfail3")]
289 #[rustc_clean(cfg="cfail2", except="Hir,HirBody,fn_sig,typeck_tables_of")]
290 #[rustc_clean(cfg="cfail3")]
291 pub extern "system" fn change_method_calling_convention(&self) { }
296 // Add Lifetime Parameter to Method --------------------------------------------
299 pub fn add_lifetime_parameter_to_method(&self) { }
303 #[rustc_clean(cfg="cfail2")]
304 #[rustc_clean(cfg="cfail3")]
306 // Warning: Note that `typeck_tables_of` are coming up clean here.
307 // The addition or removal of lifetime parameters that don't
308 // appear in the arguments or fn body in any way does not, in
309 // fact, affect the `typeck_tables_of` in any semantic way (at least
310 // as of this writing). **However,** altering the order of
311 // lowering **can** cause it appear to affect the `typeck_tables_of`:
312 // if we lower generics before the body, then the `HirId` for
313 // things in the body will be affected. So if you start to see
314 // `typeck_tables_of` appear dirty, that might be the cause. -nmatsakis
315 #[rustc_clean(cfg="cfail2", except="Hir,HirBody")]
316 #[rustc_clean(cfg="cfail3")]
317 pub fn add_lifetime_parameter_to_method
<'a
>(&self) { }
322 // Add Type Parameter To Method ------------------------------------------------
325 pub fn add_type_parameter_to_method(&self) { }
329 #[rustc_clean(cfg="cfail2")]
330 #[rustc_clean(cfg="cfail3")]
332 // Warning: Note that `typeck_tables_of` are coming up clean here.
333 // The addition or removal of type parameters that don't appear in
334 // the arguments or fn body in any way does not, in fact, affect
335 // the `typeck_tables_of` in any semantic way (at least as of this
336 // writing). **However,** altering the order of lowering **can**
337 // cause it appear to affect the `typeck_tables_of`: if we lower
338 // generics before the body, then the `HirId` for things in the
339 // body will be affected. So if you start to see `typeck_tables_of`
340 // appear dirty, that might be the cause. -nmatsakis
343 except
="Hir,HirBody,generics_of,predicates_of,type_of",
345 #[rustc_clean(cfg="cfail3")]
346 pub fn add_type_parameter_to_method
<T
>(&self) { }
351 // Add Lifetime Bound to Lifetime Parameter of Method --------------------------
354 pub fn add_lifetime_bound_to_lifetime_param_of_method
<'a
, 'b
>(&self) { }
358 #[rustc_clean(cfg="cfail2")]
359 #[rustc_clean(cfg="cfail3")]
363 except
="Hir,HirBody,generics_of,predicates_of,type_of,typeck_tables_of"
365 #[rustc_clean(cfg="cfail3")]
366 pub fn add_lifetime_bound_to_lifetime_param_of_method
<'a
, 'b
: 'a
>(&self) { }
371 // Add Lifetime Bound to Type Parameter of Method ------------------------------
374 pub fn add_lifetime_bound_to_type_param_of_method
<'a
, T
>(&self) { }
378 #[rustc_clean(cfg="cfail2")]
379 #[rustc_clean(cfg="cfail3")]
381 // Warning: Note that `typeck_tables_of` are coming up clean here.
382 // The addition or removal of bounds that don't appear in the
383 // arguments or fn body in any way does not, in fact, affect the
384 // `typeck_tables_of` in any semantic way (at least as of this
385 // writing). **However,** altering the order of lowering **can**
386 // cause it appear to affect the `typeck_tables_of`: if we lower
387 // generics before the body, then the `HirId` for things in the
388 // body will be affected. So if you start to see `typeck_tables_of`
389 // appear dirty, that might be the cause. -nmatsakis
390 #[rustc_clean(cfg="cfail2", except="Hir,HirBody,generics_of,predicates_of,\
392 #[rustc_clean(cfg="cfail3")]
393 pub fn add_lifetime_bound_to_type_param_of_method
<'a
, T
: 'a
>(&self) { }
398 // Add Trait Bound to Type Parameter of Method ------------------------------
401 pub fn add_trait_bound_to_type_param_of_method
<T
>(&self) { }
405 #[rustc_clean(cfg="cfail2")]
406 #[rustc_clean(cfg="cfail3")]
408 // Warning: Note that `typeck_tables_of` are coming up clean here.
409 // The addition or removal of bounds that don't appear in the
410 // arguments or fn body in any way does not, in fact, affect the
411 // `typeck_tables_of` in any semantic way (at least as of this
412 // writing). **However,** altering the order of lowering **can**
413 // cause it appear to affect the `typeck_tables_of`: if we lower
414 // generics before the body, then the `HirId` for things in the
415 // body will be affected. So if you start to see `typeck_tables_of`
416 // appear dirty, that might be the cause. -nmatsakis
417 #[rustc_clean(cfg="cfail2", except="Hir,HirBody,predicates_of")]
418 #[rustc_clean(cfg="cfail3")]
419 pub fn add_trait_bound_to_type_param_of_method
<T
: Clone
>(&self) { }
424 // Add #[no_mangle] to Method --------------------------------------------------
427 pub fn add_no_mangle_to_method(&self) { }
431 #[rustc_clean(cfg="cfail2")]
432 #[rustc_clean(cfg="cfail3")]
434 #[rustc_clean(cfg="cfail2", except="Hir,HirBody")]
435 #[rustc_clean(cfg="cfail3")]
437 pub fn add_no_mangle_to_method(&self) { }
444 // Add Type Parameter To Impl --------------------------------------------------
447 pub fn add_type_parameter_to_impl(&self) { }
451 #[rustc_clean(cfg="cfail2", except="Hir,HirBody,generics_of")]
452 #[rustc_clean(cfg="cfail3")]
456 except
="generics_of,fn_sig,typeck_tables_of,type_of,optimized_mir,mir_built"
458 #[rustc_clean(cfg="cfail3")]
459 pub fn add_type_parameter_to_impl(&self) { }
464 // Change Self Type of Impl ----------------------------------------------------
467 pub fn change_impl_self_type(&self) { }
471 #[rustc_clean(cfg="cfail2", except="Hir,HirBody")]
472 #[rustc_clean(cfg="cfail3")]
474 #[rustc_clean(cfg="cfail2", except="fn_sig,optimized_mir,mir_built,typeck_tables_of")]
475 #[rustc_clean(cfg="cfail3")]
476 pub fn change_impl_self_type(&self) { }
481 // Add Lifetime Bound to Impl --------------------------------------------------
484 pub fn add_lifetime_bound_to_impl_parameter(&self) { }
488 #[rustc_clean(cfg="cfail2", except="Hir,HirBody")]
489 #[rustc_clean(cfg="cfail3")]
490 impl<T
: '
static> Bar
<T
> {
491 #[rustc_clean(cfg="cfail2")]
492 #[rustc_clean(cfg="cfail3")]
493 pub fn add_lifetime_bound_to_impl_parameter(&self) { }
498 // Add Trait Bound to Impl Parameter -------------------------------------------
501 pub fn add_trait_bound_to_impl_parameter(&self) { }
505 #[rustc_clean(cfg="cfail2", except="Hir,HirBody")]
506 #[rustc_clean(cfg="cfail3")]
507 impl<T
: Clone
> Bar
<T
> {
508 #[rustc_clean(cfg="cfail2")]
509 #[rustc_clean(cfg="cfail3")]
510 pub fn add_trait_bound_to_impl_parameter(&self) { }
514 // Force instantiation of some fns so we can check their hash.
515 pub fn instantiation_root() {
516 Foo
::method_privacy();
520 Bar(0u32).change_impl_self_type();
525 Bar(0u64).change_impl_self_type();