1 // This test case tests the incremental compilation hash (ICH) implementation
2 // for struct constructor expressions.
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)]
29 // Change field value (struct-like) -----------------------------------------
30 #[cfg(any(cfail1,cfail4))]
31 pub fn change_field_value_struct_like() -> Enum
{
39 #[cfg(not(any(cfail1,cfail4)))]
40 #[rustc_clean(cfg="cfail2", except="opt_hir_owner_nodes,optimized_mir")]
41 #[rustc_clean(cfg="cfail3")]
42 #[rustc_clean(cfg="cfail5", except="opt_hir_owner_nodes,optimized_mir")]
43 #[rustc_clean(cfg="cfail6")]
44 pub fn change_field_value_struct_like() -> Enum
{
54 // Change field order (struct-like) -----------------------------------------
55 #[cfg(any(cfail1,cfail4))]
56 pub fn change_field_order_struct_like() -> Enum
{
64 #[cfg(not(any(cfail1,cfail4)))]
65 #[rustc_clean(cfg="cfail2", except="opt_hir_owner_nodes,typeck")]
66 #[rustc_clean(cfg="cfail3")]
67 #[rustc_clean(cfg="cfail5", except="opt_hir_owner_nodes,typeck,optimized_mir")]
68 #[rustc_clean(cfg="cfail6")]
69 // FIXME(michaelwoerister):Interesting. I would have thought that that changes the MIR. And it
70 // would if it were not all constants
71 pub fn change_field_order_struct_like() -> Enum
{
92 Tuple2(u64, u64, u64),
95 // Change constructor path (struct-like) ------------------------------------
96 #[cfg(any(cfail1,cfail4))]
97 pub fn change_constructor_path_struct_like() {
98 let _
= Enum
::Struct
{
105 #[cfg(not(any(cfail1,cfail4)))]
106 #[rustc_clean(cfg="cfail2", except="opt_hir_owner_nodes,typeck")]
107 #[rustc_clean(cfg="cfail3")]
108 #[rustc_clean(cfg="cfail5", except="opt_hir_owner_nodes,typeck")]
109 #[rustc_clean(cfg="cfail6")]
110 pub fn change_constructor_path_struct_like() {
111 let _
= Enum2
::Struct
{
120 // Change variant (regular struct) ------------------------------------
121 #[cfg(any(cfail1,cfail4))]
122 pub fn change_constructor_variant_struct_like() {
123 let _
= Enum2
::Struct
{
130 #[cfg(not(any(cfail1,cfail4)))]
131 #[rustc_clean(cfg="cfail2", except="opt_hir_owner_nodes")]
132 #[rustc_clean(cfg="cfail3")]
133 #[rustc_clean(cfg="cfail5", except="opt_hir_owner_nodes")]
134 #[rustc_clean(cfg="cfail6")]
135 pub fn change_constructor_variant_struct_like() {
136 let _
= Enum2
::Struct2
{
144 // Change constructor path indirectly (struct-like) -------------------------
145 pub mod change_constructor_path_indirectly_struct_like
{
146 #[cfg(any(cfail1,cfail4))]
147 use super::Enum
as TheEnum
;
148 #[cfg(not(any(cfail1,cfail4)))]
149 use super::Enum2
as TheEnum
;
151 #[rustc_clean(cfg="cfail2", except="fn_sig,opt_hir_owner_nodes,optimized_mir,typeck")]
152 #[rustc_clean(cfg="cfail3")]
153 #[rustc_clean(cfg="cfail5", except="fn_sig,opt_hir_owner_nodes,optimized_mir,typeck")]
154 #[rustc_clean(cfg="cfail6")]
155 pub fn function() -> TheEnum
{
165 // Change constructor variant indirectly (struct-like) ---------------------------
166 pub mod change_constructor_variant_indirectly_struct_like
{
168 #[cfg(any(cfail1,cfail4))]
169 use super::Enum2
::Struct
as Variant
;
170 #[cfg(not(any(cfail1,cfail4)))]
171 use super::Enum2
::Struct2
as Variant
;
173 #[rustc_clean(cfg="cfail2", except="opt_hir_owner_nodes,optimized_mir")]
174 #[rustc_clean(cfg="cfail3")]
175 #[rustc_clean(cfg="cfail5", except="opt_hir_owner_nodes,optimized_mir")]
176 #[rustc_clean(cfg="cfail6")]
177 pub fn function() -> Enum2
{
187 // Change field value (tuple-like) -------------------------------------------
188 #[cfg(any(cfail1,cfail4))]
189 pub fn change_field_value_tuple_like() -> Enum
{
193 #[cfg(not(any(cfail1,cfail4)))]
194 #[rustc_clean(cfg="cfail2", except="opt_hir_owner_nodes,optimized_mir")]
195 #[rustc_clean(cfg="cfail3")]
196 #[rustc_clean(cfg="cfail5", except="opt_hir_owner_nodes,optimized_mir")]
197 #[rustc_clean(cfg="cfail6")]
198 pub fn change_field_value_tuple_like() -> Enum
{
204 // Change constructor path (tuple-like) --------------------------------------
205 #[cfg(any(cfail1,cfail4))]
206 pub fn change_constructor_path_tuple_like() {
207 let _
= Enum
::Tuple(0, 1, 2);
210 #[cfg(not(any(cfail1,cfail4)))]
213 except
="opt_hir_owner_nodes,typeck"
215 #[rustc_clean(cfg="cfail3")]
218 except
="opt_hir_owner_nodes,typeck"
220 #[rustc_clean(cfg="cfail6")]
221 pub fn change_constructor_path_tuple_like() {
222 let _
= Enum2
::Tuple(0, 1, 2);
227 // Change constructor variant (tuple-like) --------------------------------------
228 #[cfg(any(cfail1,cfail4))]
229 pub fn change_constructor_variant_tuple_like() {
230 let _
= Enum2
::Tuple (0, 1, 2);
233 #[cfg(not(any(cfail1,cfail4)))]
236 except
="opt_hir_owner_nodes,typeck"
238 #[rustc_clean(cfg="cfail3")]
241 except
="opt_hir_owner_nodes,typeck"
243 #[rustc_clean(cfg="cfail6")]
244 pub fn change_constructor_variant_tuple_like() {
245 let _
= Enum2
::Tuple2(0, 1, 2);
249 // Change constructor path indirectly (tuple-like) ---------------------------
250 pub mod change_constructor_path_indirectly_tuple_like
{
251 #[cfg(any(cfail1,cfail4))]
252 use super::Enum
as TheEnum
;
253 #[cfg(not(any(cfail1,cfail4)))]
254 use super::Enum2
as TheEnum
;
256 #[rustc_clean(cfg="cfail2", except="fn_sig,opt_hir_owner_nodes,optimized_mir,typeck")]
257 #[rustc_clean(cfg="cfail3")]
258 #[rustc_clean(cfg="cfail5", except="fn_sig,opt_hir_owner_nodes,optimized_mir,typeck")]
259 #[rustc_clean(cfg="cfail6")]
260 pub fn function() -> TheEnum
{
261 TheEnum
::Tuple(0, 1, 2)
267 // Change constructor variant indirectly (tuple-like) ---------------------------
268 pub mod change_constructor_variant_indirectly_tuple_like
{
270 #[cfg(any(cfail1,cfail4))]
271 use super::Enum2
::Tuple
as Variant
;
272 #[cfg(not(any(cfail1,cfail4)))]
273 use super::Enum2
::Tuple2
as Variant
;
275 #[rustc_clean(cfg="cfail2", except="opt_hir_owner_nodes,optimized_mir,typeck")]
276 #[rustc_clean(cfg="cfail3")]
277 #[rustc_clean(cfg="cfail5", except="opt_hir_owner_nodes,optimized_mir,typeck")]
278 #[rustc_clean(cfg="cfail6")]
279 pub fn function() -> Enum2
{
297 // Change constructor path (C-like) --------------------------------------
298 #[cfg(any(cfail1,cfail4))]
299 pub fn change_constructor_path_c_like() {
303 #[cfg(not(any(cfail1,cfail4)))]
304 #[rustc_clean(cfg="cfail2", except="opt_hir_owner_nodes,optimized_mir,typeck")]
305 #[rustc_clean(cfg="cfail3")]
306 #[rustc_clean(cfg="cfail5", except="opt_hir_owner_nodes,optimized_mir,typeck")]
307 #[rustc_clean(cfg="cfail6")]
308 pub fn change_constructor_path_c_like() {
314 // Change constructor variant (C-like) --------------------------------------
315 #[cfg(any(cfail1,cfail4))]
316 pub fn change_constructor_variant_c_like() {
320 #[cfg(not(any(cfail1,cfail4)))]
321 #[rustc_clean(cfg="cfail2", except="opt_hir_owner_nodes,optimized_mir")]
322 #[rustc_clean(cfg="cfail3")]
323 #[rustc_clean(cfg="cfail5", except="opt_hir_owner_nodes,optimized_mir")]
324 #[rustc_clean(cfg="cfail6")]
325 pub fn change_constructor_variant_c_like() {
330 // Change constructor path indirectly (C-like) ---------------------------
331 pub mod change_constructor_path_indirectly_c_like
{
332 #[cfg(any(cfail1,cfail4))]
333 use super::Clike
as TheEnum
;
334 #[cfg(not(any(cfail1,cfail4)))]
335 use super::Clike2
as TheEnum
;
337 #[rustc_clean(cfg="cfail2", except="fn_sig,opt_hir_owner_nodes,optimized_mir,typeck")]
338 #[rustc_clean(cfg="cfail3")]
339 #[rustc_clean(cfg="cfail5", except="fn_sig,opt_hir_owner_nodes,optimized_mir,typeck")]
340 #[rustc_clean(cfg="cfail6")]
341 pub fn function() -> TheEnum
{
348 // Change constructor variant indirectly (C-like) ---------------------------
349 pub mod change_constructor_variant_indirectly_c_like
{
351 #[cfg(any(cfail1,cfail4))]
352 use super::Clike
::A
as Variant
;
353 #[cfg(not(any(cfail1,cfail4)))]
354 use super::Clike
::B
as Variant
;
356 #[rustc_clean(cfg="cfail2", except="opt_hir_owner_nodes,optimized_mir")]
357 #[rustc_clean(cfg="cfail3")]
358 #[rustc_clean(cfg="cfail5", except="opt_hir_owner_nodes,optimized_mir")]
359 #[rustc_clean(cfg="cfail6")]
360 pub fn function() -> Clike
{