1 // This test case tests the incremental compilation hash (ICH) implementation
2 // for function interfaces.
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
17 #![feature(rustc_attrs)]
18 #![crate_type = "rlib"]
20 // Add Parameter ---------------------------------------------------------------
22 #[cfg(any(cfail1,cfail4))]
23 pub fn add_parameter() {}
25 #[cfg(not(any(cfail1,cfail4)))]
28 except
= "hir_owner, hir_owner_nodes, optimized_mir, typeck, fn_sig"
30 #[rustc_clean(cfg = "cfail3")]
33 except
= "hir_owner, hir_owner_nodes, optimized_mir, typeck, fn_sig"
35 #[rustc_clean(cfg = "cfail6")]
36 pub fn add_parameter(p
: i32) {}
38 // Add Return Type -------------------------------------------------------------
40 #[cfg(any(cfail1,cfail4))]
41 pub fn add_return_type() {}
43 #[cfg(not(any(cfail1,cfail4)))]
44 #[rustc_clean(cfg = "cfail2", except = "hir_owner, hir_owner_nodes")]
45 #[rustc_clean(cfg = "cfail3")]
46 #[rustc_clean(cfg = "cfail5", except = "hir_owner, hir_owner_nodes, optimized_mir")]
47 #[rustc_clean(cfg = "cfail6")]
48 pub fn add_return_type() -> () {}
50 // Change Parameter Type -------------------------------------------------------
52 #[cfg(any(cfail1,cfail4))]
53 pub fn type_of_parameter(p
: i32) {}
55 #[cfg(not(any(cfail1,cfail4)))]
58 except
= "hir_owner, hir_owner_nodes, optimized_mir, typeck, fn_sig"
60 #[rustc_clean(cfg = "cfail3")]
63 except
= "hir_owner, hir_owner_nodes, optimized_mir, typeck, fn_sig"
65 #[rustc_clean(cfg = "cfail6")]
66 pub fn type_of_parameter(p
: i64) {}
68 // Change Parameter Type Reference ---------------------------------------------
70 #[cfg(any(cfail1,cfail4))]
71 pub fn type_of_parameter_ref(p
: &i32) {}
73 #[cfg(not(any(cfail1,cfail4)))]
76 except
= "hir_owner, hir_owner_nodes, optimized_mir, typeck, fn_sig"
78 #[rustc_clean(cfg = "cfail3")]
81 except
= "hir_owner, hir_owner_nodes, optimized_mir, typeck, fn_sig"
83 #[rustc_clean(cfg = "cfail6")]
84 pub fn type_of_parameter_ref(p
: &mut i32) {}
86 // Change Parameter Order ------------------------------------------------------
88 #[cfg(any(cfail1,cfail4))]
89 pub fn order_of_parameters(p1
: i32, p2
: i64) {}
91 #[cfg(not(any(cfail1,cfail4)))]
94 except
= "hir_owner, hir_owner_nodes, optimized_mir, typeck, fn_sig"
96 #[rustc_clean(cfg = "cfail3")]
99 except
= "hir_owner, hir_owner_nodes, optimized_mir, typeck, fn_sig"
101 #[rustc_clean(cfg = "cfail6")]
102 pub fn order_of_parameters(p2
: i64, p1
: i32) {}
104 // Unsafe ----------------------------------------------------------------------
106 #[cfg(any(cfail1,cfail4))]
107 pub fn make_unsafe() {}
109 #[cfg(not(any(cfail1,cfail4)))]
112 except
= "hir_owner, hir_owner_nodes, optimized_mir, typeck, fn_sig"
114 #[rustc_clean(cfg = "cfail3")]
117 except
= "hir_owner, hir_owner_nodes, optimized_mir, typeck, fn_sig"
119 #[rustc_clean(cfg = "cfail6")]
120 pub unsafe fn make_unsafe() {}
122 // Extern ----------------------------------------------------------------------
124 #[cfg(any(cfail1,cfail4))]
125 pub fn make_extern() {}
127 #[cfg(not(any(cfail1,cfail4)))]
128 #[rustc_clean(cfg = "cfail2", except = "hir_owner, hir_owner_nodes, typeck, fn_sig")]
129 #[rustc_clean(cfg = "cfail3")]
130 #[rustc_clean(cfg = "cfail5", except = "hir_owner, hir_owner_nodes, typeck, fn_sig")]
131 #[rustc_clean(cfg = "cfail6")]
132 pub extern "C" fn make_extern() {}
134 // Type Parameter --------------------------------------------------------------
136 #[cfg(any(cfail1,cfail4))]
137 pub fn type_parameter () {}
139 #[cfg(not(any(cfail1,cfail4)))]
142 except
= "hir_owner, hir_owner_nodes, generics_of, type_of, predicates_of"
144 #[rustc_clean(cfg = "cfail3")]
147 except
= "hir_owner, hir_owner_nodes, generics_of, type_of, predicates_of"
149 #[rustc_clean(cfg = "cfail6")]
150 pub fn type_parameter
<T
>() {}
152 // Lifetime Parameter ----------------------------------------------------------
154 #[cfg(any(cfail1,cfail4))]
155 pub fn lifetime_parameter () {}
157 #[cfg(not(any(cfail1,cfail4)))]
158 #[rustc_clean(cfg = "cfail2", except = "hir_owner, hir_owner_nodes, generics_of,fn_sig")]
159 #[rustc_clean(cfg = "cfail3")]
160 #[rustc_clean(cfg = "cfail5", except = "hir_owner, hir_owner_nodes, generics_of,fn_sig")]
161 #[rustc_clean(cfg = "cfail6")]
162 pub fn lifetime_parameter
<'a
>() {}
164 // Trait Bound -----------------------------------------------------------------
166 #[cfg(any(cfail1,cfail4))]
167 pub fn trait_bound
<T
>() {}
169 #[cfg(not(any(cfail1,cfail4)))]
170 #[rustc_clean(cfg = "cfail2", except = "hir_owner, hir_owner_nodes, predicates_of")]
171 #[rustc_clean(cfg = "cfail3")]
172 pub fn trait_bound
<T
: Eq
>() {}
174 // Builtin Bound ---------------------------------------------------------------
176 #[cfg(any(cfail1,cfail4))]
177 pub fn builtin_bound
<T
>() {}
179 #[cfg(not(any(cfail1,cfail4)))]
180 #[rustc_clean(cfg = "cfail2", except = "hir_owner, hir_owner_nodes, predicates_of")]
181 #[rustc_clean(cfg = "cfail3")]
182 #[rustc_clean(cfg = "cfail5", except = "hir_owner, hir_owner_nodes, predicates_of")]
183 #[rustc_clean(cfg = "cfail6")]
184 pub fn builtin_bound
<T
: Send
>() {}
186 // Lifetime Bound --------------------------------------------------------------
188 #[cfg(any(cfail1,cfail4))]
189 pub fn lifetime_bound
<'a
, T
>() {}
191 #[cfg(not(any(cfail1,cfail4)))]
194 except
= "hir_owner, hir_owner_nodes, generics_of, type_of, predicates_of,fn_sig"
196 #[rustc_clean(cfg = "cfail3")]
199 except
= "hir_owner, hir_owner_nodes, generics_of, type_of, predicates_of,fn_sig,optimized_mir"
201 #[rustc_clean(cfg = "cfail6")]
202 pub fn lifetime_bound
<'a
, T
: 'a
>() {}
204 // Second Trait Bound ----------------------------------------------------------
206 #[cfg(any(cfail1,cfail4))]
207 pub fn second_trait_bound
<T
: Eq
>() {}
209 #[cfg(not(any(cfail1,cfail4)))]
210 #[rustc_clean(cfg = "cfail2", except = "hir_owner, hir_owner_nodes, predicates_of")]
211 #[rustc_clean(cfg = "cfail3")]
212 pub fn second_trait_bound
<T
: Eq
+ Clone
>() {}
214 // Second Builtin Bound --------------------------------------------------------
216 #[cfg(any(cfail1,cfail4))]
217 pub fn second_builtin_bound
<T
: Send
>() {}
219 #[cfg(not(any(cfail1,cfail4)))]
220 #[rustc_clean(cfg = "cfail2", except = "hir_owner, hir_owner_nodes, predicates_of")]
221 #[rustc_clean(cfg = "cfail3")]
222 #[rustc_clean(cfg = "cfail5", except = "hir_owner, hir_owner_nodes, predicates_of")]
223 #[rustc_clean(cfg = "cfail6")]
224 pub fn second_builtin_bound
<T
: Send
+ Sized
>() {}
226 // Second Lifetime Bound -------------------------------------------------------
228 #[cfg(any(cfail1,cfail4))]
229 pub fn second_lifetime_bound
<'a
, 'b
, T
: 'a
>() {}
231 #[cfg(not(any(cfail1,cfail4)))]
234 except
= "hir_owner, hir_owner_nodes, generics_of, type_of, predicates_of,fn_sig"
236 #[rustc_clean(cfg = "cfail3")]
239 except
= "hir_owner, hir_owner_nodes, generics_of, type_of, predicates_of,fn_sig"
241 #[rustc_clean(cfg = "cfail6")]
242 pub fn second_lifetime_bound
<'a
, 'b
, T
: 'a
+ 'b
>() {}
244 // Inline ----------------------------------------------------------------------
246 #[cfg(any(cfail1,cfail4))]
249 #[cfg(not(any(cfail1,cfail4)))]
250 #[rustc_clean(cfg = "cfail2")]
251 #[rustc_clean(cfg = "cfail3")]
252 #[rustc_clean(cfg = "cfail5")]
253 #[rustc_clean(cfg = "cfail6")]
257 // Inline Never ----------------------------------------------------------------
259 #[cfg(any(cfail1,cfail4))]
261 pub fn inline_never() {}
263 #[cfg(not(any(cfail1,cfail4)))]
264 #[rustc_clean(cfg = "cfail2")]
265 #[rustc_clean(cfg = "cfail3")]
266 #[rustc_clean(cfg = "cfail5")]
267 #[rustc_clean(cfg = "cfail6")]
269 pub fn inline_never() {}
271 // No Mangle -------------------------------------------------------------------
273 #[cfg(any(cfail1,cfail4))]
274 pub fn no_mangle() {}
276 #[cfg(not(any(cfail1,cfail4)))]
277 #[rustc_clean(cfg = "cfail2")]
278 #[rustc_clean(cfg = "cfail3")]
279 #[rustc_clean(cfg = "cfail5")]
280 #[rustc_clean(cfg = "cfail6")]
282 pub fn no_mangle() {}
284 // Linkage ---------------------------------------------------------------------
286 #[cfg(any(cfail1,cfail4))]
289 #[cfg(not(any(cfail1,cfail4)))]
290 #[rustc_clean(cfg = "cfail2")]
291 #[rustc_clean(cfg = "cfail3")]
292 #[rustc_clean(cfg = "cfail5")]
293 #[rustc_clean(cfg = "cfail6")]
294 #[linkage = "weak_odr"]
297 // Return Impl Trait -----------------------------------------------------------
299 #[cfg(any(cfail1,cfail4))]
300 pub fn return_impl_trait() -> i32 {
304 #[cfg(not(any(cfail1,cfail4)))]
305 #[rustc_clean(cfg = "cfail2", except = "hir_owner, hir_owner_nodes, typeck, fn_sig, optimized_mir")]
306 #[rustc_clean(cfg = "cfail3")]
307 #[rustc_clean(cfg = "cfail5", except = "hir_owner, hir_owner_nodes, typeck, fn_sig, optimized_mir")]
308 #[rustc_clean(cfg = "cfail6")]
309 pub fn return_impl_trait() -> impl Clone
{
313 // Change Return Impl Trait ----------------------------------------------------
315 #[cfg(any(cfail1,cfail4))]
316 pub fn change_return_impl_trait() -> impl Clone
{
320 #[cfg(not(any(cfail1,cfail4)))]
321 #[rustc_clean(cfg = "cfail2")]
322 #[rustc_clean(cfg = "cfail3")]
323 #[rustc_clean(cfg = "cfail5", except = "typeck")]
324 #[rustc_clean(cfg = "cfail6")]
325 pub fn change_return_impl_trait() -> impl Copy
{
329 // Change Return Type Indirectly -----------------------------------------------
331 pub struct ReferencedType1
;
332 pub struct ReferencedType2
;
334 pub mod change_return_type_indirectly
{
335 #[cfg(any(cfail1,cfail4))]
336 use super::ReferencedType1
as ReturnType
;
337 #[cfg(not(any(cfail1,cfail4)))]
338 use super::ReferencedType2
as ReturnType
;
342 except
= "hir_owner, hir_owner_nodes, optimized_mir, typeck, fn_sig"
344 #[rustc_clean(cfg = "cfail3")]
347 except
= "hir_owner, hir_owner_nodes, optimized_mir, typeck, fn_sig"
349 #[rustc_clean(cfg = "cfail6")]
350 pub fn indirect_return_type() -> ReturnType
{
355 // Change Parameter Type Indirectly --------------------------------------------
357 pub mod change_parameter_type_indirectly
{
358 #[cfg(any(cfail1,cfail4))]
359 use super::ReferencedType1
as ParameterType
;
360 #[cfg(not(any(cfail1,cfail4)))]
361 use super::ReferencedType2
as ParameterType
;
365 except
= "hir_owner, hir_owner_nodes, optimized_mir, typeck, fn_sig"
367 #[rustc_clean(cfg = "cfail3")]
370 except
= "hir_owner, hir_owner_nodes, optimized_mir, typeck, fn_sig"
372 #[rustc_clean(cfg = "cfail6")]
373 pub fn indirect_parameter_type(p
: ParameterType
) {}
376 // Change Trait Bound Indirectly -----------------------------------------------
378 pub trait ReferencedTrait1 {}
379 pub trait ReferencedTrait2 {}
381 pub mod change_trait_bound_indirectly
{
382 #[cfg(any(cfail1,cfail4))]
383 use super::ReferencedTrait1
as Trait
;
384 #[cfg(not(any(cfail1,cfail4)))]
385 use super::ReferencedTrait2
as Trait
;
387 #[rustc_clean(cfg = "cfail2", except = "hir_owner, hir_owner_nodes, predicates_of")]
388 #[rustc_clean(cfg = "cfail3")]
389 #[rustc_clean(cfg = "cfail5", except = "hir_owner, hir_owner_nodes, predicates_of")]
390 #[rustc_clean(cfg = "cfail6")]
391 pub fn indirect_trait_bound
<T
: Trait
>(p
: T
) {}
394 // Change Trait Bound Indirectly In Where Clause -------------------------------
396 pub mod change_trait_bound_indirectly_in_where_clause
{
397 #[cfg(any(cfail1,cfail4))]
398 use super::ReferencedTrait1
as Trait
;
399 #[cfg(not(any(cfail1,cfail4)))]
400 use super::ReferencedTrait2
as Trait
;
402 #[rustc_clean(cfg = "cfail2", except = "hir_owner, hir_owner_nodes, predicates_of")]
403 #[rustc_clean(cfg = "cfail3")]
404 #[rustc_clean(cfg = "cfail5", except = "hir_owner, hir_owner_nodes, predicates_of")]
405 #[rustc_clean(cfg = "cfail6")]
406 pub fn indirect_trait_bound_where
<T
>(p
: T
)