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 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
20 #![feature(rustc_attrs)]
23 fn callee1(_x: u32, _y: i64) {}
24 fn callee2(_x: u32, _y: i64) {}
27 // Change Callee (Function)
28 #[cfg(any(cfail1,cfail4))]
29 pub fn change_callee_function() {
33 #[cfg(not(any(cfail1,cfail4)))]
34 #[rustc_clean(cfg="cfail2", except="hir_owner_nodes,optimized_mir,typeck")]
35 #[rustc_clean(cfg="cfail3")]
36 #[rustc_clean(cfg="cfail5", except="hir_owner_nodes,optimized_mir,typeck")]
37 #[rustc_clean(cfg="cfail6")]
38 pub fn change_callee_function() {
44 // Change Argument (Function)
45 #[cfg(any(cfail1,cfail4))]
46 pub fn change_argument_function() {
50 #[cfg(not(any(cfail1,cfail4)))]
51 #[rustc_clean(cfg="cfail2", except="hir_owner_nodes,optimized_mir")]
52 #[rustc_clean(cfg="cfail3")]
53 #[rustc_clean(cfg="cfail5", except="hir_owner_nodes,optimized_mir")]
54 #[rustc_clean(cfg="cfail6")]
55 pub fn change_argument_function() {
61 // Change Callee Indirectly (Function)
62 mod change_callee_indirectly_function {
63 #[cfg(any(cfail1,cfail4))]
64 use super::callee1 as callee;
65 #[cfg(not(any(cfail1,cfail4)))]
66 use super::callee2 as callee;
68 #[rustc_clean(except="hir_owner_nodes,typeck", cfg="cfail2")]
69 #[rustc_clean(cfg="cfail3")]
70 #[rustc_clean(except="hir_owner_nodes,typeck", cfg="cfail5")]
71 #[rustc_clean(cfg="cfail6")]
72 pub fn change_callee_indirectly_function() {
80 fn method1(&self, _x: char, _y: bool) {}
81 fn method2(&self, _x: char, _y: bool) {}
84 // Change Callee (Method)
85 #[cfg(any(cfail1,cfail4))]
86 pub fn change_callee_method() {
91 #[cfg(not(any(cfail1,cfail4)))]
92 #[rustc_clean(cfg="cfail2", except="hir_owner_nodes,optimized_mir,typeck")]
93 #[rustc_clean(cfg="cfail3")]
94 #[rustc_clean(cfg="cfail5", except="hir_owner_nodes,optimized_mir,typeck")]
95 #[rustc_clean(cfg="cfail6")]
96 pub fn change_callee_method() {
103 // Change Argument (Method)
104 #[cfg(any(cfail1,cfail4))]
105 pub fn change_argument_method() {
107 s.method1('x', true);
110 #[cfg(not(any(cfail1,cfail4)))]
111 #[rustc_clean(cfg="cfail2", except="hir_owner_nodes,optimized_mir")]
112 #[rustc_clean(cfg="cfail3")]
113 #[rustc_clean(cfg="cfail5", except="hir_owner_nodes,optimized_mir")]
114 #[rustc_clean(cfg="cfail6")]
115 pub fn change_argument_method() {
117 s.method1('y', true);
122 // Change Callee (Method, UFCS)
123 #[cfg(any(cfail1,cfail4))]
124 pub fn change_ufcs_callee_method() {
126 Struct::method1(&s, 'x', true);
129 #[cfg(not(any(cfail1,cfail4)))]
130 #[rustc_clean(cfg="cfail2", except="hir_owner_nodes,optimized_mir,typeck")]
131 #[rustc_clean(cfg="cfail3")]
132 #[rustc_clean(cfg="cfail5", except="hir_owner_nodes,optimized_mir,typeck")]
133 #[rustc_clean(cfg="cfail6")]
134 pub fn change_ufcs_callee_method() {
136 Struct::method2(&s, 'x', true);
141 // Change Argument (Method, UFCS)
142 #[cfg(any(cfail1,cfail4))]
143 pub fn change_argument_method_ufcs() {
145 Struct::method1(&s, 'x', true);
148 #[cfg(not(any(cfail1,cfail4)))]
149 #[rustc_clean(cfg="cfail2", except="hir_owner_nodes,optimized_mir")]
150 #[rustc_clean(cfg="cfail3")]
151 #[rustc_clean(cfg="cfail5", except="hir_owner_nodes,optimized_mir")]
152 #[rustc_clean(cfg="cfail6")]
153 pub fn change_argument_method_ufcs() {
155 Struct::method1(&s, 'x',false);
161 #[cfg(any(cfail1,cfail4))]
162 pub fn change_to_ufcs() {
164 s.method1('x', true); // ------
167 #[cfg(not(any(cfail1,cfail4)))]
168 #[rustc_clean(cfg="cfail2", except="hir_owner_nodes,optimized_mir,typeck")]
169 #[rustc_clean(cfg="cfail3")]
170 #[rustc_clean(cfg="cfail5", except="hir_owner_nodes,optimized_mir,typeck")]
171 #[rustc_clean(cfg="cfail6")]
172 // One might think this would be expanded in the hir_owner_nodes/Mir, but it actually
173 // results in slightly different hir_owner/Mir.
174 pub fn change_to_ufcs() {
176 Struct::method1(&s, 'x', true);
182 fn method1(&self, _x: char, _y: bool) {}
185 // Change UFCS Callee Indirectly
186 pub mod change_ufcs_callee_indirectly {
187 #[cfg(any(cfail1,cfail4))]
188 use super::Struct as Struct;
189 #[cfg(not(any(cfail1,cfail4)))]
190 use super::Struct2 as Struct;
192 #[rustc_clean(cfg="cfail2", except="hir_owner_nodes,optimized_mir,typeck")]
193 #[rustc_clean(cfg="cfail3")]
194 #[rustc_clean(cfg="cfail5", except="hir_owner_nodes,optimized_mir,typeck")]
195 #[rustc_clean(cfg="cfail6")]
196 pub fn change_ufcs_callee_indirectly() {
198 Struct::method1(&s, 'q', false)