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
14 #![feature(rustc_attrs)]
15 #![crate_type = "rlib"]
17 // Add Parameter ---------------------------------------------------------------
20 pub fn add_parameter() {}
25 except = "hir_owner, hir_owner_nodes, optimized_mir, typeck, fn_sig"
27 #[rustc_clean(cfg = "cfail3")]
28 pub fn add_parameter(p: i32) {}
30 // Add Return Type -------------------------------------------------------------
33 pub fn add_return_type() {}
36 #[rustc_clean(cfg = "cfail2", except = "hir_owner, hir_owner_nodes")]
37 #[rustc_clean(cfg = "cfail3")]
38 pub fn add_return_type() -> () {}
40 // Change Parameter Type -------------------------------------------------------
43 pub fn type_of_parameter(p: i32) {}
48 except = "hir_owner, hir_owner_nodes, optimized_mir, typeck, fn_sig"
50 #[rustc_clean(cfg = "cfail3")]
51 pub fn type_of_parameter(p: i64) {}
53 // Change Parameter Type Reference ---------------------------------------------
56 pub fn type_of_parameter_ref(p: &i32) {}
61 except = "hir_owner, hir_owner_nodes, optimized_mir, typeck, fn_sig"
63 #[rustc_clean(cfg = "cfail3")]
64 pub fn type_of_parameter_ref(p: &mut i32) {}
66 // Change Parameter Order ------------------------------------------------------
69 pub fn order_of_parameters(p1: i32, p2: i64) {}
74 except = "hir_owner, hir_owner_nodes, optimized_mir, typeck, fn_sig"
76 #[rustc_clean(cfg = "cfail3")]
77 pub fn order_of_parameters(p2: i64, p1: i32) {}
79 // Unsafe ----------------------------------------------------------------------
82 pub fn make_unsafe() {}
87 except = "hir_owner, hir_owner_nodes, optimized_mir, typeck, fn_sig"
89 #[rustc_clean(cfg = "cfail3")]
90 pub unsafe fn make_unsafe() {}
92 // Extern ----------------------------------------------------------------------
95 pub fn make_extern() {}
98 #[rustc_clean(cfg = "cfail2", except = "hir_owner, hir_owner_nodes, typeck, fn_sig")]
99 #[rustc_clean(cfg = "cfail3")]
100 pub extern "C" fn make_extern() {}
102 // Type Parameter --------------------------------------------------------------
105 pub fn type_parameter() {}
110 except = "hir_owner, hir_owner_nodes, generics_of, type_of, predicates_of"
112 #[rustc_clean(cfg = "cfail3")]
113 pub fn type_parameter<T>() {}
115 // Lifetime Parameter ----------------------------------------------------------
118 pub fn lifetime_parameter() {}
121 #[rustc_clean(cfg = "cfail2", except = "hir_owner, hir_owner_nodes, generics_of")]
122 #[rustc_clean(cfg = "cfail3")]
123 pub fn lifetime_parameter<'a>() {}
125 // Trait Bound -----------------------------------------------------------------
128 pub fn trait_bound<T>() {}
131 #[rustc_clean(cfg = "cfail2", except = "hir_owner, hir_owner_nodes, predicates_of")]
132 #[rustc_clean(cfg = "cfail3")]
133 pub fn trait_bound<T: Eq>() {}
135 // Builtin Bound ---------------------------------------------------------------
138 pub fn builtin_bound<T>() {}
141 #[rustc_clean(cfg = "cfail2", except = "hir_owner, hir_owner_nodes, predicates_of")]
142 #[rustc_clean(cfg = "cfail3")]
143 pub fn builtin_bound<T: Send>() {}
145 // Lifetime Bound --------------------------------------------------------------
148 pub fn lifetime_bound<'a, T>() {}
153 except = "hir_owner, hir_owner_nodes, generics_of, type_of, predicates_of"
155 #[rustc_clean(cfg = "cfail3")]
156 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_owner, hir_owner_nodes, predicates_of")]
165 #[rustc_clean(cfg = "cfail3")]
166 pub fn second_trait_bound<T: Eq + Clone>() {}
168 // Second Builtin Bound --------------------------------------------------------
171 pub fn second_builtin_bound<T: Send>() {}
174 #[rustc_clean(cfg = "cfail2", except = "hir_owner, hir_owner_nodes, predicates_of")]
175 #[rustc_clean(cfg = "cfail3")]
176 pub fn second_builtin_bound<T: Send + Sized>() {}
178 // Second Lifetime Bound -------------------------------------------------------
181 pub fn second_lifetime_bound<'a, 'b, T: 'a>() {}
186 except = "hir_owner, hir_owner_nodes, generics_of, type_of, predicates_of"
188 #[rustc_clean(cfg = "cfail3")]
189 pub fn second_lifetime_bound<'a, 'b, T: 'a + 'b>() {}
191 // Inline ----------------------------------------------------------------------
197 #[rustc_clean(cfg = "cfail2", except = "hir_owner, hir_owner_nodes")]
198 #[rustc_clean(cfg = "cfail3")]
202 // Inline Never ----------------------------------------------------------------
206 pub fn inline_never() {}
209 #[rustc_clean(cfg = "cfail2", except = "hir_owner, hir_owner_nodes")]
210 #[rustc_clean(cfg = "cfail3")]
212 pub fn inline_never() {}
214 // No Mangle -------------------------------------------------------------------
217 pub fn no_mangle() {}
220 #[rustc_clean(cfg = "cfail2", except = "hir_owner, hir_owner_nodes")]
221 #[rustc_clean(cfg = "cfail3")]
223 pub fn no_mangle() {}
225 // Linkage ---------------------------------------------------------------------
231 #[rustc_clean(cfg = "cfail2", except = "hir_owner, hir_owner_nodes")]
232 #[rustc_clean(cfg = "cfail3")]
233 #[linkage = "weak_odr"]
236 // Return Impl Trait -----------------------------------------------------------
239 pub fn return_impl_trait() -> i32 {
244 #[rustc_clean(cfg = "cfail2", except = "hir_owner, hir_owner_nodes, typeck, fn_sig")]
245 #[rustc_clean(cfg = "cfail3")]
246 pub fn return_impl_trait() -> impl Clone {
250 // Change Return Impl Trait ----------------------------------------------------
253 pub fn change_return_impl_trait() -> impl Clone {
258 #[rustc_clean(cfg = "cfail2")]
259 #[rustc_clean(cfg = "cfail3")]
260 pub fn change_return_impl_trait() -> impl Copy {
264 // Change Return Type Indirectly -----------------------------------------------
266 pub struct ReferencedType1;
267 pub struct ReferencedType2;
269 pub mod change_return_type_indirectly {
271 use super::ReferencedType1 as ReturnType;
273 use super::ReferencedType2 as ReturnType;
277 except = "hir_owner, hir_owner_nodes, optimized_mir, typeck, fn_sig"
279 #[rustc_clean(cfg = "cfail3")]
280 pub fn indirect_return_type() -> ReturnType {
285 // Change Parameter Type Indirectly --------------------------------------------
287 pub mod change_parameter_type_indirectly {
289 use super::ReferencedType1 as ParameterType;
291 use super::ReferencedType2 as ParameterType;
295 except = "hir_owner, hir_owner_nodes, optimized_mir, typeck, fn_sig"
297 #[rustc_clean(cfg = "cfail3")]
298 pub fn indirect_parameter_type(p: ParameterType) {}
301 // Change Trait Bound Indirectly -----------------------------------------------
303 pub trait ReferencedTrait1 {}
304 pub trait ReferencedTrait2 {}
306 pub mod change_trait_bound_indirectly {
308 use super::ReferencedTrait1 as Trait;
310 use super::ReferencedTrait2 as Trait;
312 #[rustc_clean(cfg = "cfail2", except = "hir_owner, hir_owner_nodes, predicates_of")]
313 #[rustc_clean(cfg = "cfail3")]
314 pub fn indirect_trait_bound<T: Trait>(p: T) {}
317 // Change Trait Bound Indirectly In Where Clause -------------------------------
319 pub mod change_trait_bound_indirectly_in_where_clause {
321 use super::ReferencedTrait1 as Trait;
323 use super::ReferencedTrait2 as Trait;
325 #[rustc_clean(cfg = "cfail2", except = "hir_owner, hir_owner_nodes, predicates_of")]
326 #[rustc_clean(cfg = "cfail3")]
327 pub fn indirect_trait_bound_where<T>(p: T)