1 // This test case tests the incremental compilation hash (ICH) implementation
2 // for `extern` modules.
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
16 #![feature(rustc_attrs)]
17 #![feature(unboxed_closures)]
18 #![crate_type = "rlib"]
20 // Change function name --------------------------------------------------------
21 #[cfg(any(cfail1,cfail4))]
23 pub fn change_function_name1(c
: i64) -> i32;
26 #[cfg(not(any(cfail1,cfail4)))]
27 #[rustc_clean(cfg = "cfail2", except = "hir_owner,hir_owner_nodes")]
28 #[rustc_clean(cfg = "cfail3")]
29 #[rustc_clean(cfg = "cfail5", except = "hir_owner,hir_owner_nodes")]
30 #[rustc_clean(cfg = "cfail6")]
32 pub fn change_function_name2(c
: i64) -> i32;
35 // Change parameter name -------------------------------------------------------
36 #[cfg(any(cfail1,cfail4))]
38 pub fn change_parameter_name(c
: i64) -> i32;
41 #[cfg(not(any(cfail1,cfail4)))]
42 #[rustc_clean(cfg = "cfail2")]
43 #[rustc_clean(cfg = "cfail3")]
44 #[rustc_clean(cfg = "cfail5")]
45 #[rustc_clean(cfg = "cfail6")]
47 pub fn change_parameter_name(d
: i64) -> i32;
50 // Change parameter type -------------------------------------------------------
51 #[cfg(any(cfail1,cfail4))]
53 pub fn change_parameter_type(c
: i64) -> i32;
56 #[cfg(not(any(cfail1,cfail4)))]
57 #[rustc_clean(cfg = "cfail2")]
58 #[rustc_clean(cfg = "cfail3")]
59 #[rustc_clean(cfg = "cfail5")]
60 #[rustc_clean(cfg = "cfail6")]
62 pub fn change_parameter_type(c
: i32) -> i32;
65 // Change return type ----------------------------------------------------------
66 #[cfg(any(cfail1,cfail4))]
68 pub fn change_return_type(c
: i32) -> i32;
71 #[cfg(not(any(cfail1,cfail4)))]
72 #[rustc_clean(cfg = "cfail2")]
73 #[rustc_clean(cfg = "cfail3")]
74 #[rustc_clean(cfg = "cfail5")]
75 #[rustc_clean(cfg = "cfail6")]
77 pub fn change_return_type(c
: i32) -> i8 ;
80 // Add parameter ---------------------------------------------------------------
81 #[cfg(any(cfail1,cfail4))]
83 pub fn add_parameter(c
: i32 ) -> i32;
86 #[cfg(not(any(cfail1,cfail4)))]
87 #[rustc_clean(cfg = "cfail2")]
88 #[rustc_clean(cfg = "cfail3")]
89 #[rustc_clean(cfg = "cfail5")]
90 #[rustc_clean(cfg = "cfail6")]
92 pub fn add_parameter(c
: i32, d
: i32) -> i32;
95 // Add return type -------------------------------------------------------------
96 #[cfg(any(cfail1,cfail4))]
98 pub fn add_return_type(c
: i32) ;
101 #[cfg(not(any(cfail1,cfail4)))]
102 #[rustc_clean(cfg = "cfail2")]
103 #[rustc_clean(cfg = "cfail3")]
104 #[rustc_clean(cfg = "cfail5")]
105 #[rustc_clean(cfg = "cfail6")]
107 pub fn add_return_type(c
: i32) -> i32;
110 // Make function variadic ------------------------------------------------------
111 #[cfg(any(cfail1,cfail4))]
113 pub fn make_function_variadic(c
: i32 );
116 #[cfg(not(any(cfail1,cfail4)))]
117 #[rustc_clean(cfg = "cfail2")]
118 #[rustc_clean(cfg = "cfail3")]
119 #[rustc_clean(cfg = "cfail5")]
120 #[rustc_clean(cfg = "cfail6")]
122 pub fn make_function_variadic(c
: i32, ...);
125 // Change calling convention ---------------------------------------------------
126 #[cfg(any(cfail1,cfail4))]
128 pub fn change_calling_convention(c
: (i32,));
131 #[cfg(not(any(cfail1,cfail4)))]
132 #[rustc_clean(cfg = "cfail2", except = "hir_owner,hir_owner_nodes")]
133 #[rustc_clean(cfg = "cfail3")]
134 #[rustc_clean(cfg = "cfail5", except = "hir_owner,hir_owner_nodes")]
135 #[rustc_clean(cfg = "cfail6")]
137 pub fn change_calling_convention(c
: (i32,));
140 // Make function public --------------------------------------------------------
141 #[cfg(any(cfail1,cfail4))]
143 fn make_function_public(c
: i32);
146 #[cfg(not(any(cfail1,cfail4)))]
147 #[rustc_clean(cfg = "cfail2")]
148 #[rustc_clean(cfg = "cfail3")]
149 #[rustc_clean(cfg = "cfail5")]
150 #[rustc_clean(cfg = "cfail6")]
152 pub fn make_function_public(c
: i32);
155 // Add function ----------------------------------------------------------------
156 #[cfg(any(cfail1,cfail4))]
158 pub fn add_function1(c
: i32);
161 #[cfg(not(any(cfail1,cfail4)))]
162 #[rustc_clean(cfg = "cfail2", except = "hir_owner,hir_owner_nodes")]
163 #[rustc_clean(cfg = "cfail3")]
164 #[rustc_clean(cfg = "cfail5", except = "hir_owner,hir_owner_nodes")]
165 #[rustc_clean(cfg = "cfail6")]
167 pub fn add_function1(c
: i32);
168 pub fn add_function2();
171 // Change link-name ------------------------------------------------------------
172 #[cfg(any(cfail1,cfail4))]
173 #[link(name = "foo")]
175 pub fn change_link_name(c
: i32);
178 #[cfg(not(any(cfail1,cfail4)))]
179 #[rustc_clean(cfg = "cfail2")]
180 #[rustc_clean(cfg = "cfail3")]
181 #[rustc_clean(cfg = "cfail5")]
182 #[rustc_clean(cfg = "cfail6")]
183 #[link(name = "bar")]
185 pub fn change_link_name(c
: i32);
191 // Indirectly change parameter type --------------------------------------------
192 mod indirectly_change_parameter_type
{
193 #[cfg(any(cfail1,cfail4))]
194 use super::c_i32
as c_int
;
195 #[cfg(not(any(cfail1,cfail4)))]
196 use super::c_i64
as c_int
;
198 #[rustc_clean(cfg = "cfail2")]
199 #[rustc_clean(cfg = "cfail3")]
200 #[rustc_clean(cfg = "cfail5")]
201 #[rustc_clean(cfg = "cfail6")]
203 pub fn indirectly_change_parameter_type(c
: c_int
);
207 // Indirectly change return type --------------------------------------------
208 mod indirectly_change_return_type
{
209 #[cfg(any(cfail1,cfail4))]
210 use super::c_i32
as c_int
;
211 #[cfg(not(any(cfail1,cfail4)))]
212 use super::c_i64
as c_int
;
214 #[rustc_clean(cfg = "cfail2")]
215 #[rustc_clean(cfg = "cfail3")]
216 #[rustc_clean(cfg = "cfail5")]
217 #[rustc_clean(cfg = "cfail6")]
219 pub fn indirectly_change_return_type() -> c_int
;