1 // This test case tests the incremental compilation hash (ICH) implementation
2 // for function and method call 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)]
17 fn callee1(_x: u32, _y: i64) {}
18 fn callee2(_x: u32, _y: i64) {}
21 // Change Callee (Function)
23 pub fn change_callee_function() {
28 #[rustc_clean(cfg="cfail2", except="hir_owner_nodes,mir_built,optimized_mir,typeck_tables_of")]
29 #[rustc_clean(cfg="cfail3")]
30 pub fn change_callee_function() {
36 // Change Argument (Function)
38 pub fn change_argument_function() {
43 #[rustc_clean(cfg="cfail2", except="hir_owner_nodes,mir_built,optimized_mir")]
44 #[rustc_clean(cfg="cfail3")]
45 pub fn change_argument_function() {
51 // Change Callee Indirectly (Function)
52 mod change_callee_indirectly_function {
54 use super::callee1 as callee;
56 use super::callee2 as callee;
58 #[rustc_clean(label="hir_owner", cfg="cfail2")]
59 #[rustc_clean(label="hir_owner", cfg="cfail3")]
60 #[rustc_dirty(label="hir_owner_nodes", cfg="cfail2")]
61 #[rustc_clean(label="hir_owner_nodes", cfg="cfail3")]
64 pub fn change_callee_indirectly_function() {
72 fn method1(&self, _x: char, _y: bool) {}
73 fn method2(&self, _x: char, _y: bool) {}
76 // Change Callee (Method)
78 pub fn change_callee_method() {
84 #[rustc_clean(cfg="cfail2", except="hir_owner_nodes,mir_built,optimized_mir,typeck_tables_of")]
85 #[rustc_clean(cfg="cfail3")]
86 pub fn change_callee_method() {
93 // Change Argument (Method)
95 pub fn change_argument_method() {
101 #[rustc_clean(cfg="cfail2", except="hir_owner_nodes,mir_built,optimized_mir")]
102 #[rustc_clean(cfg="cfail3")]
103 pub fn change_argument_method() {
105 s.method1('y', true);
110 // Change Callee (Method, UFCS)
112 pub fn change_ufcs_callee_method() {
114 Struct::method1(&s, 'x', true);
118 #[rustc_clean(cfg="cfail2", except="hir_owner_nodes,mir_built,optimized_mir,typeck_tables_of")]
119 #[rustc_clean(cfg="cfail3")]
120 pub fn change_ufcs_callee_method() {
122 Struct::method2(&s, 'x', true);
127 // Change Argument (Method, UFCS)
129 pub fn change_argument_method_ufcs() {
131 Struct::method1(&s, 'x', true);
135 #[rustc_clean(cfg="cfail2", except="hir_owner_nodes,mir_built,optimized_mir")]
136 #[rustc_clean(cfg="cfail3")]
137 pub fn change_argument_method_ufcs() {
139 Struct::method1(&s, 'x', false);
146 pub fn change_to_ufcs() {
148 s.method1('x', true);
152 #[rustc_clean(cfg="cfail2", except="hir_owner_nodes,mir_built,optimized_mir,typeck_tables_of")]
153 #[rustc_clean(cfg="cfail3")]
154 // One might think this would be expanded in the hir_owner_nodes/Mir, but it actually
155 // results in slightly different hir_owner/Mir.
156 pub fn change_to_ufcs() {
158 Struct::method1(&s, 'x', true);
164 fn method1(&self, _x: char, _y: bool) {}
167 // Change UFCS Callee Indirectly
168 pub mod change_ufcs_callee_indirectly {
170 use super::Struct as Struct;
172 use super::Struct2 as Struct;
174 #[rustc_clean(cfg="cfail2", except="hir_owner_nodes,mir_built,optimized_mir,typeck_tables_of")]
175 #[rustc_clean(cfg="cfail3")]
178 pub fn change_ufcs_callee_indirectly() {
180 Struct::method1(&s, 'q', false)