1 // Copyright 2016 The Rust Project Developers. See the COPYRIGHT
2 // file at the top-level directory of this distribution and at
3 // http://rust-lang.org/COPYRIGHT.
5 // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6 // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7 // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8 // option. This file may not be copied, modified, or distributed
9 // except according to those terms.
12 // This test case tests the incremental compilation hash (ICH) implementation
13 // for `extern` modules.
15 // The general pattern followed here is: Change one thing between rev1 and rev2
16 // and make sure that the hash has changed, then change nothing between rev2 and
17 // rev3 and make sure that the hash has not changed.
20 // revisions: cfail1 cfail2 cfail3
21 // compile-flags: -Z query-dep-graph -Zincremental-ignore-spans
24 #![feature(rustc_attrs)]
25 #![feature(unboxed_closures)]
26 #![feature(link_args)]
30 // Change function name --------------------------------------------------------
33 pub fn change_function_name1(c: i64) -> i32;
37 #[rustc_dirty(cfg="cfail2")]
38 #[rustc_clean(cfg="cfail3")]
40 pub fn change_function_name2(c: i64) -> i32;
45 // Change parameter name -------------------------------------------------------
48 pub fn change_parameter_name(c: i64) -> i32;
52 #[rustc_dirty(cfg="cfail2")]
53 #[rustc_clean(cfg="cfail3")]
55 pub fn change_parameter_name(d: i64) -> i32;
60 // Change parameter type -------------------------------------------------------
63 pub fn change_parameter_type(c: i64) -> i32;
67 #[rustc_dirty(cfg="cfail2")]
68 #[rustc_clean(cfg="cfail3")]
70 pub fn change_parameter_type(c: i32) -> i32;
75 // Change return type ----------------------------------------------------------
78 pub fn change_return_type(c: i32) -> i32;
82 #[rustc_dirty(cfg="cfail2")]
83 #[rustc_clean(cfg="cfail3")]
85 pub fn change_return_type(c: i32) -> i8;
90 // Add parameter ---------------------------------------------------------------
93 pub fn add_parameter(c: i32) -> i32;
97 #[rustc_dirty(cfg="cfail2")]
98 #[rustc_clean(cfg="cfail3")]
100 pub fn add_parameter(c: i32, d: i32) -> i32;
105 // Add return type -------------------------------------------------------------
108 pub fn add_return_type(c: i32);
112 #[rustc_dirty(cfg="cfail2")]
113 #[rustc_clean(cfg="cfail3")]
115 pub fn add_return_type(c: i32) -> i32;
120 // Make function variadic ------------------------------------------------------
123 pub fn make_function_variadic(c: i32);
127 #[rustc_dirty(cfg="cfail2")]
128 #[rustc_clean(cfg="cfail3")]
130 pub fn make_function_variadic(c: i32, ...);
135 // Change calling convention ---------------------------------------------------
138 pub fn change_calling_convention(c: i32);
142 #[rustc_dirty(cfg="cfail2")]
143 #[rustc_clean(cfg="cfail3")]
145 pub fn change_calling_convention(c: i32);
150 // Make function public --------------------------------------------------------
153 fn make_function_public(c: i32);
157 #[rustc_dirty(cfg="cfail2")]
158 #[rustc_clean(cfg="cfail3")]
160 pub fn make_function_public(c: i32);
165 // Add function ----------------------------------------------------------------
168 pub fn add_function1(c: i32);
172 #[rustc_dirty(cfg="cfail2")]
173 #[rustc_clean(cfg="cfail3")]
175 pub fn add_function1(c: i32);
176 pub fn add_function2();
181 // Change link-args ------------------------------------------------------------
183 #[link_args = "-foo -bar"]
185 pub fn change_link_args(c: i32);
189 #[rustc_dirty(cfg="cfail2")]
190 #[rustc_clean(cfg="cfail3")]
191 #[link_args = "-foo -bar -baz"]
193 pub fn change_link_args(c: i32);
198 // Change link-name ------------------------------------------------------------
200 #[link(name = "foo")]
202 pub fn change_link_name(c: i32);
206 #[rustc_dirty(cfg="cfail2")]
207 #[rustc_clean(cfg="cfail3")]
208 #[link(name = "bar")]
210 pub fn change_link_name(c: i32);
216 // Indirectly change parameter type --------------------------------------------
217 mod indirectly_change_parameter_type {
219 use super::c_i32 as c_int;
221 use super::c_i64 as c_int;
223 #[rustc_dirty(cfg="cfail2")]
224 #[rustc_clean(cfg="cfail3")]
226 pub fn indirectly_change_parameter_type(c: c_int);
232 // Indirectly change return type --------------------------------------------
233 mod indirectly_change_return_type {
235 use super::c_i32 as c_int;
237 use super::c_i64 as c_int;
239 #[rustc_dirty(cfg="cfail2")]
240 #[rustc_clean(cfg="cfail3")]
242 pub fn indirectly_change_return_type() -> c_int;