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.
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,AssociatedItemDefIds")]
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")]
45 #[rustc_clean(cfg="cfail2", except="HirBody,optimized_mir,mir_built,TypeckTables")]
46 #[rustc_clean(cfg="cfail3")]
47 pub fn method_body() {
48 println!("Hello, world!");
53 // Change Method Body (inlined) ------------------------------------------------
55 // This should affect the method itself, but not the impl.
59 pub fn method_body_inlined() { }
63 #[rustc_clean(cfg="cfail2")]
64 #[rustc_clean(cfg="cfail3")]
66 #[rustc_clean(cfg="cfail2", except="HirBody,optimized_mir,mir_built,TypeckTables")]
67 #[rustc_clean(cfg="cfail3")]
69 pub fn method_body_inlined() {
70 println!("Hello, world!");
75 // Change Method Privacy -------------------------------------------------------
78 pub fn method_privacy() { }
82 #[rustc_clean(cfg="cfail2", except="Hir,HirBody")]
83 #[rustc_clean(cfg="cfail3")]
85 #[rustc_clean(cfg="cfail2", except="AssociatedItems,Hir,HirBody")]
86 #[rustc_clean(cfg="cfail3")]
87 fn method_privacy() { }
90 // Change Method Selfness -----------------------------------------------------------
93 pub fn method_selfness() { }
97 #[rustc_clean(cfg="cfail2", except="Hir,HirBody")]
98 #[rustc_clean(cfg="cfail3")]
100 #[rustc_dirty(cfg="cfail2", except="type_of,predicates_of")]
101 #[rustc_clean(cfg="cfail3")]
102 pub fn method_selfness(&self) { }
105 // Change Method Selfmutness ---------------------------------------------------
108 pub fn method_selfmutness(&self) { }
112 #[rustc_clean(cfg="cfail2")]
113 #[rustc_clean(cfg="cfail3")]
117 except="Hir,HirBody,FnSignature,TypeckTables,optimized_mir,mir_built"
119 #[rustc_clean(cfg="cfail3")]
120 pub fn method_selfmutness(&mut self) { }
125 // Add Method To Impl ----------------------------------------------------------
128 pub fn add_method_to_impl1(&self) { }
132 #[rustc_clean(cfg="cfail2", except="Hir,HirBody,AssociatedItemDefIds")]
133 #[rustc_clean(cfg="cfail3")]
135 #[rustc_clean(cfg="cfail2")]
136 #[rustc_clean(cfg="cfail3")]
137 pub fn add_method_to_impl1(&self) { }
139 #[rustc_clean(cfg="cfail3")]
140 pub fn add_method_to_impl2(&self) { }
145 // Add Method Parameter --------------------------------------------------------
148 pub fn add_method_parameter(&self) { }
152 #[rustc_clean(cfg="cfail2")]
153 #[rustc_clean(cfg="cfail3")]
157 except="Hir,HirBody,FnSignature,TypeckTables,optimized_mir,mir_built"
159 #[rustc_clean(cfg="cfail3")]
160 pub fn add_method_parameter(&self, _: i32) { }
165 // Change Method Parameter Name ------------------------------------------------
168 pub fn change_method_parameter_name(&self, a: i64) { }
172 #[rustc_clean(cfg="cfail2")]
173 #[rustc_clean(cfg="cfail3")]
175 #[rustc_clean(cfg="cfail2", except="HirBody,optimized_mir,mir_built")]
176 #[rustc_clean(cfg="cfail3")]
177 pub fn change_method_parameter_name(&self, b: i64) { }
182 // Change Method Return Type ---------------------------------------------------
185 pub fn change_method_return_type(&self) -> u16 { 0 }
189 #[rustc_clean(cfg="cfail2")]
190 #[rustc_clean(cfg="cfail3")]
194 except="Hir,HirBody,FnSignature,optimized_mir,mir_built,TypeckTables")]
195 #[rustc_clean(cfg="cfail3")]
196 pub fn change_method_return_type(&self) -> u8 { 0 }
201 // Make Method #[inline] -------------------------------------------------------
204 pub fn make_method_inline(&self) -> u8 { 0 }
208 #[rustc_clean(cfg="cfail2")]
209 #[rustc_clean(cfg="cfail3")]
211 #[rustc_clean(cfg="cfail2", except="Hir,HirBody")]
212 #[rustc_clean(cfg="cfail3")]
214 pub fn make_method_inline(&self) -> u8 { 0 }
219 // Change order of parameters -------------------------------------------------
222 pub fn change_method_parameter_order(&self, a: i64, b: i64) { }
226 #[rustc_clean(cfg="cfail2")]
227 #[rustc_clean(cfg="cfail3")]
229 #[rustc_clean(cfg="cfail2", except="HirBody,optimized_mir,mir_built")]
230 #[rustc_clean(cfg="cfail3")]
231 pub fn change_method_parameter_order(&self, b: i64, a: i64) { }
236 // Make method unsafe ----------------------------------------------------------
239 pub fn make_method_unsafe(&self) { }
243 #[rustc_clean(cfg="cfail2")]
244 #[rustc_clean(cfg="cfail3")]
248 except="Hir,HirBody,FnSignature,TypeckTables,optimized_mir,mir_built"
250 #[rustc_clean(cfg="cfail3")]
251 pub unsafe fn make_method_unsafe(&self) { }
256 // Make method extern ----------------------------------------------------------
259 pub fn make_method_extern(&self) { }
263 #[rustc_clean(cfg="cfail2")]
264 #[rustc_clean(cfg="cfail3")]
266 #[rustc_clean(cfg="cfail2", except="Hir,HirBody,mir_built,FnSignature,TypeckTables")]
267 #[rustc_clean(cfg="cfail3")]
268 pub extern fn make_method_extern(&self) { }
273 // Change method calling convention --------------------------------------------
276 pub extern "C" fn change_method_calling_convention(&self) { }
280 #[rustc_clean(cfg="cfail2")]
281 #[rustc_clean(cfg="cfail3")]
283 #[rustc_clean(cfg="cfail2", except="Hir,HirBody,FnSignature,TypeckTables")]
284 #[rustc_clean(cfg="cfail3")]
285 pub extern "system" fn change_method_calling_convention(&self) { }
290 // Add Lifetime Parameter to Method --------------------------------------------
293 pub fn add_lifetime_parameter_to_method(&self) { }
297 #[rustc_clean(cfg="cfail2")]
298 #[rustc_clean(cfg="cfail3")]
300 // Warning: Note that `TypeckTables` are coming up clean here.
301 // The addition or removal of lifetime parameters that don't
302 // appear in the arguments or fn body in any way does not, in
303 // fact, affect the `TypeckTables` in any semantic way (at least
304 // as of this writing). **However,** altering the order of
305 // lowering **can** cause it appear to affect the `TypeckTables`:
306 // if we lower generics before the body, then the `HirId` for
307 // things in the body will be affected. So if you start to see
308 // `TypeckTables` appear dirty, that might be the cause. -nmatsakis
309 #[rustc_clean(cfg="cfail2", except="Hir,HirBody")]
310 #[rustc_clean(cfg="cfail3")]
311 pub fn add_lifetime_parameter_to_method<'a>(&self) { }
316 // Add Type Parameter To Method ------------------------------------------------
319 pub fn add_type_parameter_to_method(&self) { }
323 #[rustc_clean(cfg="cfail2")]
324 #[rustc_clean(cfg="cfail3")]
326 // Warning: Note that `TypeckTables` are coming up clean here.
327 // The addition or removal of type parameters that don't appear in
328 // the arguments or fn body in any way does not, in fact, affect
329 // the `TypeckTables` in any semantic way (at least as of this
330 // writing). **However,** altering the order of lowering **can**
331 // cause it appear to affect the `TypeckTables`: if we lower
332 // generics before the body, then the `HirId` for things in the
333 // body will be affected. So if you start to see `TypeckTables`
334 // appear dirty, that might be the cause. -nmatsakis
337 except="Hir,HirBody,generics_of,predicates_of,type_of",
339 #[rustc_clean(cfg="cfail3")]
340 pub fn add_type_parameter_to_method<T>(&self) { }
345 // Add Lifetime Bound to Lifetime Parameter of Method --------------------------
348 pub fn add_lifetime_bound_to_lifetime_param_of_method<'a, 'b>(&self) { }
352 #[rustc_clean(cfg="cfail2")]
353 #[rustc_clean(cfg="cfail3")]
357 except="Hir,HirBody,generics_of,predicates_of,type_of,TypeckTables"
359 #[rustc_clean(cfg="cfail3")]
360 pub fn add_lifetime_bound_to_lifetime_param_of_method<'a, 'b: 'a>(&self) { }
365 // Add Lifetime Bound to Type Parameter of Method ------------------------------
368 pub fn add_lifetime_bound_to_type_param_of_method<'a, T>(&self) { }
372 #[rustc_clean(cfg="cfail2")]
373 #[rustc_clean(cfg="cfail3")]
375 // Warning: Note that `TypeckTables` are coming up clean here.
376 // The addition or removal of bounds that don't appear in the
377 // arguments or fn body in any way does not, in fact, affect the
378 // `TypeckTables` in any semantic way (at least as of this
379 // writing). **However,** altering the order of lowering **can**
380 // cause it appear to affect the `TypeckTables`: if we lower
381 // generics before the body, then the `HirId` for things in the
382 // body will be affected. So if you start to see `TypeckTables`
383 // appear dirty, that might be the cause. -nmatsakis
384 #[rustc_clean(cfg="cfail2", except="Hir,HirBody,generics_of,predicates_of,\
386 #[rustc_clean(cfg="cfail3")]
387 pub fn add_lifetime_bound_to_type_param_of_method<'a, T: 'a>(&self) { }
392 // Add Trait Bound to Type Parameter of Method ------------------------------
395 pub fn add_trait_bound_to_type_param_of_method<T>(&self) { }
399 #[rustc_clean(cfg="cfail2")]
400 #[rustc_clean(cfg="cfail3")]
402 // Warning: Note that `TypeckTables` are coming up clean here.
403 // The addition or removal of bounds that don't appear in the
404 // arguments or fn body in any way does not, in fact, affect the
405 // `TypeckTables` in any semantic way (at least as of this
406 // writing). **However,** altering the order of lowering **can**
407 // cause it appear to affect the `TypeckTables`: if we lower
408 // generics before the body, then the `HirId` for things in the
409 // body will be affected. So if you start to see `TypeckTables`
410 // appear dirty, that might be the cause. -nmatsakis
411 #[rustc_clean(cfg="cfail2", except="Hir,HirBody,predicates_of")]
412 #[rustc_clean(cfg="cfail3")]
413 pub fn add_trait_bound_to_type_param_of_method<T: Clone>(&self) { }
418 // Add #[no_mangle] to Method --------------------------------------------------
421 pub fn add_no_mangle_to_method(&self) { }
425 #[rustc_clean(cfg="cfail2")]
426 #[rustc_clean(cfg="cfail3")]
428 #[rustc_clean(cfg="cfail2", except="Hir,HirBody")]
429 #[rustc_clean(cfg="cfail3")]
431 pub fn add_no_mangle_to_method(&self) { }
438 // Add Type Parameter To Impl --------------------------------------------------
441 pub fn add_type_parameter_to_impl(&self) { }
445 #[rustc_clean(cfg="cfail2", except="Hir,HirBody,generics_of")]
446 #[rustc_clean(cfg="cfail3")]
450 except="generics_of,FnSignature,TypeckTables,type_of,optimized_mir,mir_built"
452 #[rustc_clean(cfg="cfail3")]
453 pub fn add_type_parameter_to_impl(&self) { }
458 // Change Self Type of Impl ----------------------------------------------------
461 pub fn change_impl_self_type(&self) { }
465 #[rustc_clean(cfg="cfail2", except="Hir,HirBody")]
466 #[rustc_clean(cfg="cfail3")]
468 #[rustc_clean(cfg="cfail2", except="FnSignature,optimized_mir,mir_built,TypeckTables")]
469 #[rustc_clean(cfg="cfail3")]
470 pub fn change_impl_self_type(&self) { }
475 // Add Lifetime Bound to Impl --------------------------------------------------
478 pub fn add_lifetime_bound_to_impl_parameter(&self) { }
482 #[rustc_clean(cfg="cfail2", except="Hir,HirBody")]
483 #[rustc_clean(cfg="cfail3")]
484 impl<T: 'static> Bar<T> {
485 #[rustc_clean(cfg="cfail2")]
486 #[rustc_clean(cfg="cfail3")]
487 pub fn add_lifetime_bound_to_impl_parameter(&self) { }
492 // Add Trait Bound to Impl Parameter -------------------------------------------
495 pub fn add_trait_bound_to_impl_parameter(&self) { }
499 #[rustc_clean(cfg="cfail2", except="Hir,HirBody")]
500 #[rustc_clean(cfg="cfail3")]
501 impl<T: Clone> Bar<T> {
502 #[rustc_clean(cfg="cfail2")]
503 #[rustc_clean(cfg="cfail3")]
504 pub fn add_trait_bound_to_impl_parameter(&self) { }
508 // Force instantiation of some fns so we can check their hash.
509 pub fn instantiation_root() {
510 Foo::method_privacy();
514 Bar(0u32).change_impl_self_type();
519 Bar(0u64).change_impl_self_type();