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
10 // compile-flags: -Z query-dep-graph -Zincremental-ignore-spans
15 #![feature(rustc_attrs)]
16 #![crate_type = "rlib"]
19 // Add Parameter ---------------------------------------------------------------
22 pub fn add_parameter() {}
25 #[rustc_clean(cfg = "cfail2",
26 except = "Hir, HirBody, mir_built, optimized_mir, typeck_tables_of, fn_sig")]
27 #[rustc_clean(cfg = "cfail3")]
28 pub fn add_parameter(p: i32) {}
31 // Add Return Type -------------------------------------------------------------
34 pub fn add_return_type() {}
37 #[rustc_clean(cfg = "cfail2", except = "Hir, HirBody")]
38 #[rustc_clean(cfg = "cfail3")]
39 pub fn add_return_type() -> () {}
42 // Change Parameter Type -------------------------------------------------------
45 pub fn type_of_parameter(p: i32) {}
48 #[rustc_clean(cfg = "cfail2",
49 except = "Hir, HirBody, mir_built, optimized_mir, typeck_tables_of, fn_sig")]
50 #[rustc_clean(cfg = "cfail3")]
51 pub fn type_of_parameter(p: i64) {}
54 // Change Parameter Type Reference ---------------------------------------------
57 pub fn type_of_parameter_ref(p: &i32) {}
60 #[rustc_clean(cfg = "cfail2",
61 except = "Hir, HirBody, mir_built, optimized_mir, typeck_tables_of, fn_sig")]
62 #[rustc_clean(cfg = "cfail3")]
63 pub fn type_of_parameter_ref(p: &mut i32) {}
66 // Change Parameter Order ------------------------------------------------------
69 pub fn order_of_parameters(p1: i32, p2: i64) {}
72 #[rustc_clean(cfg = "cfail2",
73 except = "Hir, HirBody, mir_built, optimized_mir, typeck_tables_of, fn_sig")]
74 #[rustc_clean(cfg = "cfail3")]
75 pub fn order_of_parameters(p2: i64, p1: i32) {}
78 // Unsafe ----------------------------------------------------------------------
81 pub fn make_unsafe() {}
84 #[rustc_clean(cfg = "cfail2",
85 except = "Hir, HirBody, mir_built, optimized_mir, typeck_tables_of, fn_sig")]
86 #[rustc_clean(cfg = "cfail3")]
87 pub unsafe fn make_unsafe() {}
90 // Extern ----------------------------------------------------------------------
93 pub fn make_extern() {}
96 #[rustc_clean(cfg = "cfail2", except = "Hir, HirBody, typeck_tables_of, fn_sig")]
97 #[rustc_clean(cfg = "cfail3")]
98 pub extern "C" fn make_extern() {}
101 // Type Parameter --------------------------------------------------------------
104 pub fn type_parameter() {}
107 #[rustc_clean(cfg = "cfail2",
108 except = "Hir, HirBody, generics_of, type_of, predicates_of")]
109 #[rustc_clean(cfg = "cfail3")]
110 pub fn type_parameter<T>() {}
113 // Lifetime Parameter ----------------------------------------------------------
116 pub fn lifetime_parameter() {}
119 #[rustc_clean(cfg = "cfail2", except = "Hir, HirBody, generics_of")]
120 #[rustc_clean(cfg = "cfail3")]
121 pub fn lifetime_parameter<'a>() {}
124 // Trait Bound -----------------------------------------------------------------
127 pub fn trait_bound<T>() {}
130 #[rustc_clean(cfg = "cfail2", except = "Hir, HirBody, predicates_of")]
131 #[rustc_clean(cfg = "cfail3")]
132 pub fn trait_bound<T: Eq>() {}
135 // Builtin Bound ---------------------------------------------------------------
138 pub fn builtin_bound<T>() {}
141 #[rustc_clean(cfg = "cfail2", except = "Hir, HirBody, predicates_of")]
142 #[rustc_clean(cfg = "cfail3")]
143 pub fn builtin_bound<T: Send>() {}
146 // Lifetime Bound --------------------------------------------------------------
149 pub fn lifetime_bound<'a, T>() {}
152 #[rustc_clean(cfg = "cfail2",
153 except = "Hir, HirBody, generics_of, type_of, predicates_of")]
154 #[rustc_clean(cfg = "cfail3")]
155 pub fn lifetime_bound<'a, T: 'a>() {}
158 // Second Trait Bound ----------------------------------------------------------
161 pub fn second_trait_bound<T: Eq>() {}
164 #[rustc_clean(cfg = "cfail2", except = "Hir, HirBody, predicates_of")]
165 #[rustc_clean(cfg = "cfail3")]
166 pub fn second_trait_bound<T: Eq + Clone>() {}
169 // Second Builtin Bound --------------------------------------------------------
172 pub fn second_builtin_bound<T: Send>() {}
175 #[rustc_clean(cfg = "cfail2", except = "Hir, HirBody, predicates_of")]
176 #[rustc_clean(cfg = "cfail3")]
177 pub fn second_builtin_bound<T: Send + Sized>() {}
180 // Second Lifetime Bound -------------------------------------------------------
183 pub fn second_lifetime_bound<'a, 'b, T: 'a>() {}
186 #[rustc_clean(cfg = "cfail2",
187 except = "Hir, HirBody, generics_of, type_of, predicates_of")]
188 #[rustc_clean(cfg = "cfail3")]
189 pub fn second_lifetime_bound<'a, 'b, T: 'a + 'b>() {}
192 // Inline ----------------------------------------------------------------------
198 #[rustc_clean(cfg = "cfail2", except = "Hir, HirBody")]
199 #[rustc_clean(cfg = "cfail3")]
204 // Inline Never ----------------------------------------------------------------
208 pub fn inline_never() {}
211 #[rustc_clean(cfg = "cfail2", except = "Hir, HirBody")]
212 #[rustc_clean(cfg = "cfail3")]
214 pub fn inline_never() {}
217 // No Mangle -------------------------------------------------------------------
220 pub fn no_mangle() {}
223 #[rustc_clean(cfg = "cfail2", except = "Hir, HirBody")]
224 #[rustc_clean(cfg = "cfail3")]
226 pub fn no_mangle() {}
229 // Linkage ---------------------------------------------------------------------
235 #[rustc_clean(cfg = "cfail2", except = "Hir, HirBody")]
236 #[rustc_clean(cfg = "cfail3")]
237 #[linkage = "weak_odr"]
241 // Return Impl Trait -----------------------------------------------------------
244 pub fn return_impl_trait() -> i32 {
249 #[rustc_clean(cfg = "cfail2", except = "Hir, HirBody, typeck_tables_of, fn_sig")]
250 #[rustc_clean(cfg = "cfail3")]
251 pub fn return_impl_trait() -> impl Clone {
256 // Change Return Impl Trait ----------------------------------------------------
259 pub fn change_return_impl_trait() -> impl Clone {
264 #[rustc_clean(cfg = "cfail2")]
265 #[rustc_clean(cfg = "cfail3")]
266 pub fn change_return_impl_trait() -> impl Copy {
271 // Change Return Type Indirectly -----------------------------------------------
273 pub struct ReferencedType1;
274 pub struct ReferencedType2;
276 pub mod change_return_type_indirectly {
278 use super::ReferencedType1 as ReturnType;
280 use super::ReferencedType2 as ReturnType;
282 #[rustc_clean(cfg = "cfail2",
283 except = "Hir, HirBody, mir_built, optimized_mir, typeck_tables_of, fn_sig")]
284 #[rustc_clean(cfg = "cfail3")]
285 pub fn indirect_return_type() -> ReturnType {
291 // Change Parameter Type Indirectly --------------------------------------------
293 pub mod change_parameter_type_indirectly {
295 use super::ReferencedType1 as ParameterType;
297 use super::ReferencedType2 as ParameterType;
299 #[rustc_clean(cfg = "cfail2",
300 except = "Hir, HirBody, mir_built, optimized_mir, typeck_tables_of, fn_sig")]
301 #[rustc_clean(cfg = "cfail3")]
302 pub fn indirect_parameter_type(p: ParameterType) {}
306 // Change Trait Bound Indirectly -----------------------------------------------
308 pub trait ReferencedTrait1 {}
309 pub trait ReferencedTrait2 {}
311 pub mod change_trait_bound_indirectly {
313 use super::ReferencedTrait1 as Trait;
315 use super::ReferencedTrait2 as Trait;
317 #[rustc_clean(cfg = "cfail2", except = "Hir, HirBody, predicates_of")]
318 #[rustc_clean(cfg = "cfail3")]
319 pub fn indirect_trait_bound<T: Trait>(p: T) {}
323 // Change Trait Bound Indirectly In Where Clause -------------------------------
325 pub mod change_trait_bound_indirectly_in_where_clause {
327 use super::ReferencedTrait1 as Trait;
329 use super::ReferencedTrait2 as Trait;
331 #[rustc_clean(cfg = "cfail2", except = "Hir, HirBody, predicates_of")]
332 #[rustc_clean(cfg = "cfail3")]
333 pub fn indirect_trait_bound_where<T>(p: T)