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.
9 // revisions: cfail1 cfail2 cfail3
10 // compile-flags: -Z query-dep-graph -Zincremental-ignore-spans
14 #![feature(intrinsics)]
16 #![feature(rustc_attrs)]
17 #![crate_type = "rlib"]
20 // Add Parameter ---------------------------------------------------------------
23 pub fn add_parameter() {}
26 #[rustc_clean(cfg = "cfail2",
27 except = "Hir, HirBody, mir_built, optimized_mir, TypeckTables, FnSignature")]
28 #[rustc_clean(cfg = "cfail3")]
29 pub fn add_parameter(p: i32) {}
32 // Add Return Type -------------------------------------------------------------
35 pub fn add_return_type() {}
38 #[rustc_clean(cfg = "cfail2", except = "Hir, HirBody")]
39 #[rustc_clean(cfg = "cfail3")]
40 pub fn add_return_type() -> () {}
43 // Change Parameter Type -------------------------------------------------------
46 pub fn type_of_parameter(p: i32) {}
49 #[rustc_clean(cfg = "cfail2",
50 except = "Hir, HirBody, mir_built, optimized_mir, TypeckTables, FnSignature")]
51 #[rustc_clean(cfg = "cfail3")]
52 pub fn type_of_parameter(p: i64) {}
55 // Change Parameter Type Reference ---------------------------------------------
58 pub fn type_of_parameter_ref(p: &i32) {}
61 #[rustc_clean(cfg = "cfail2",
62 except = "Hir, HirBody, mir_built, optimized_mir, TypeckTables, FnSignature")]
63 #[rustc_clean(cfg = "cfail3")]
64 pub fn type_of_parameter_ref(p: &mut i32) {}
67 // Change Parameter Order ------------------------------------------------------
70 pub fn order_of_parameters(p1: i32, p2: i64) {}
73 #[rustc_clean(cfg = "cfail2",
74 except = "Hir, HirBody, mir_built, optimized_mir, TypeckTables, FnSignature")]
75 #[rustc_clean(cfg = "cfail3")]
76 pub fn order_of_parameters(p2: i64, p1: i32) {}
79 // Unsafe ----------------------------------------------------------------------
82 pub fn make_unsafe() {}
85 #[rustc_clean(cfg = "cfail2",
86 except = "Hir, HirBody, mir_built, optimized_mir, TypeckTables, FnSignature")]
87 #[rustc_clean(cfg = "cfail3")]
88 pub unsafe fn make_unsafe() {}
91 // Extern ----------------------------------------------------------------------
94 pub fn make_extern() {}
97 #[rustc_clean(cfg = "cfail2", except = "Hir, HirBody, mir_built, TypeckTables, FnSignature")]
98 #[rustc_clean(cfg = "cfail3")]
99 pub extern "C" fn make_extern() {}
102 // Extern C Extern Rust-Intrinsic ----------------------------------------------
105 pub extern "C" fn make_intrinsic() {}
108 #[rustc_clean(cfg = "cfail2", except = "Hir, HirBody, TypeckTables, FnSignature")]
109 #[rustc_clean(cfg = "cfail3")]
110 pub extern "rust-intrinsic" fn make_intrinsic() {}
113 // Type Parameter --------------------------------------------------------------
116 pub fn type_parameter() {}
119 #[rustc_clean(cfg = "cfail2",
120 except = "Hir, HirBody, generics_of, type_of, predicates_of")]
121 #[rustc_clean(cfg = "cfail3")]
122 pub fn type_parameter<T>() {}
125 // Lifetime Parameter ----------------------------------------------------------
128 pub fn lifetime_parameter() {}
131 #[rustc_clean(cfg = "cfail2", except = "Hir, HirBody, generics_of")]
132 #[rustc_clean(cfg = "cfail3")]
133 pub fn lifetime_parameter<'a>() {}
136 // Trait Bound -----------------------------------------------------------------
139 pub fn trait_bound<T>() {}
142 #[rustc_clean(cfg = "cfail2", except = "Hir, HirBody, predicates_of")]
143 #[rustc_clean(cfg = "cfail3")]
144 pub fn trait_bound<T: Eq>() {}
147 // Builtin Bound ---------------------------------------------------------------
150 pub fn builtin_bound<T>() {}
153 #[rustc_clean(cfg = "cfail2", except = "Hir, HirBody, predicates_of")]
154 #[rustc_clean(cfg = "cfail3")]
155 pub fn builtin_bound<T: Send>() {}
158 // Lifetime Bound --------------------------------------------------------------
161 pub fn lifetime_bound<'a, T>() {}
164 #[rustc_clean(cfg = "cfail2",
165 except = "Hir, HirBody, generics_of, type_of, predicates_of")]
166 #[rustc_clean(cfg = "cfail3")]
167 pub fn lifetime_bound<'a, T: 'a>() {}
170 // Second Trait Bound ----------------------------------------------------------
173 pub fn second_trait_bound<T: Eq>() {}
176 #[rustc_clean(cfg = "cfail2", except = "Hir, HirBody, predicates_of")]
177 #[rustc_clean(cfg = "cfail3")]
178 pub fn second_trait_bound<T: Eq + Clone>() {}
181 // Second Builtin Bound --------------------------------------------------------
184 pub fn second_builtin_bound<T: Send>() {}
187 #[rustc_clean(cfg = "cfail2", except = "Hir, HirBody, predicates_of")]
188 #[rustc_clean(cfg = "cfail3")]
189 pub fn second_builtin_bound<T: Send + Sized>() {}
192 // Second Lifetime Bound -------------------------------------------------------
195 pub fn second_lifetime_bound<'a, 'b, T: 'a>() {}
198 #[rustc_clean(cfg = "cfail2",
199 except = "Hir, HirBody, generics_of, type_of, predicates_of")]
200 #[rustc_clean(cfg = "cfail3")]
201 pub fn second_lifetime_bound<'a, 'b, T: 'a + 'b>() {}
204 // Inline ----------------------------------------------------------------------
210 #[rustc_clean(cfg = "cfail2", except = "Hir, HirBody")]
211 #[rustc_clean(cfg = "cfail3")]
216 // Inline Never ----------------------------------------------------------------
220 pub fn inline_never() {}
223 #[rustc_clean(cfg = "cfail2", except = "Hir, HirBody")]
224 #[rustc_clean(cfg = "cfail3")]
226 pub fn inline_never() {}
229 // No Mangle -------------------------------------------------------------------
232 pub fn no_mangle() {}
235 #[rustc_clean(cfg = "cfail2", except = "Hir, HirBody")]
236 #[rustc_clean(cfg = "cfail3")]
238 pub fn no_mangle() {}
241 // Linkage ---------------------------------------------------------------------
247 #[rustc_clean(cfg = "cfail2", except = "Hir, HirBody")]
248 #[rustc_clean(cfg = "cfail3")]
249 #[linkage = "weak_odr"]
253 // Return Impl Trait -----------------------------------------------------------
256 pub fn return_impl_trait() -> i32 {
261 #[rustc_clean(cfg = "cfail2", except = "Hir, HirBody, TypeckTables, FnSignature")]
262 #[rustc_clean(cfg = "cfail3")]
263 pub fn return_impl_trait() -> impl Clone {
268 // Change Return Impl Trait ----------------------------------------------------
271 pub fn change_return_impl_trait() -> impl Clone {
276 #[rustc_clean(cfg = "cfail2")]
277 #[rustc_clean(cfg = "cfail3")]
278 pub fn change_return_impl_trait() -> impl Copy {
283 // Change Return Type Indirectly -----------------------------------------------
285 pub struct ReferencedType1;
286 pub struct ReferencedType2;
288 pub mod change_return_type_indirectly {
290 use super::ReferencedType1 as ReturnType;
292 use super::ReferencedType2 as ReturnType;
294 #[rustc_clean(cfg = "cfail2",
295 except = "Hir, HirBody, mir_built, optimized_mir, TypeckTables, FnSignature")]
296 #[rustc_clean(cfg = "cfail3")]
297 pub fn indirect_return_type() -> ReturnType {
303 // Change Parameter Type Indirectly --------------------------------------------
305 pub mod change_parameter_type_indirectly {
307 use super::ReferencedType1 as ParameterType;
309 use super::ReferencedType2 as ParameterType;
311 #[rustc_clean(cfg = "cfail2",
312 except = "Hir, HirBody, mir_built, optimized_mir, TypeckTables, FnSignature")]
313 #[rustc_clean(cfg = "cfail3")]
314 pub fn indirect_parameter_type(p: ParameterType) {}
318 // Change Trait Bound Indirectly -----------------------------------------------
320 pub trait ReferencedTrait1 {}
321 pub trait ReferencedTrait2 {}
323 pub mod change_trait_bound_indirectly {
325 use super::ReferencedTrait1 as Trait;
327 use super::ReferencedTrait2 as Trait;
329 #[rustc_clean(cfg = "cfail2", except = "Hir, HirBody, predicates_of")]
330 #[rustc_clean(cfg = "cfail3")]
331 pub fn indirect_trait_bound<T: Trait>(p: T) {}
335 // Change Trait Bound Indirectly In Where Clause -------------------------------
337 pub mod change_trait_bound_indirectly_in_where_clause {
339 use super::ReferencedTrait1 as Trait;
341 use super::ReferencedTrait2 as Trait;
343 #[rustc_clean(cfg = "cfail2", except = "Hir, HirBody, predicates_of")]
344 #[rustc_clean(cfg = "cfail3")]
345 pub fn indirect_trait_bound_where<T>(p: T)