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
10 // compile-flags: -Z query-dep-graph -Zincremental-ignore-spans
13 #![feature(rustc_attrs)]
26 // Change field value (struct-like) -----------------------------------------
28 pub fn change_field_value_struct_like() -> Enum {
37 #[rustc_clean(cfg="cfail2", except="HirBody,optimized_mir,mir_built")]
38 #[rustc_clean(cfg="cfail3")]
39 pub fn change_field_value_struct_like() -> Enum {
49 // Change field order (struct-like) -----------------------------------------
51 pub fn change_field_order_struct_like() -> Enum {
60 #[rustc_clean(cfg="cfail2", except="HirBody,typeck_tables_of")]
61 #[rustc_clean(cfg="cfail3")]
62 // FIXME(michaelwoerister):Interesting. I would have thought that that changes the MIR. And it
63 // would if it were not all constants
64 pub fn change_field_order_struct_like() -> Enum {
85 Tuple2(u64, u64, u64),
88 // Change constructor path (struct-like) ------------------------------------
90 pub fn change_constructor_path_struct_like() {
91 let _ = Enum::Struct {
99 #[rustc_clean(cfg="cfail2", except="HirBody,optimized_mir,mir_built,typeck_tables_of")]
100 #[rustc_clean(cfg="cfail3")]
101 pub fn change_constructor_path_struct_like() {
102 let _ = Enum2::Struct {
111 // Change variant (regular struct) ------------------------------------
113 pub fn change_constructor_variant_struct_like() {
114 let _ = Enum2::Struct {
122 #[rustc_clean(cfg="cfail2", except="HirBody,optimized_mir,mir_built")]
123 #[rustc_clean(cfg="cfail3")]
124 pub fn change_constructor_variant_struct_like() {
125 let _ = Enum2::Struct2 {
133 // Change constructor path indirectly (struct-like) -------------------------
134 pub mod change_constructor_path_indirectly_struct_like {
136 use super::Enum as TheEnum;
138 use super::Enum2 as TheEnum;
142 except="fn_sig,Hir,HirBody,optimized_mir,mir_built,\
145 #[rustc_clean(cfg="cfail3")]
146 pub fn function() -> TheEnum {
156 // Change constructor variant indirectly (struct-like) ---------------------------
157 pub mod change_constructor_variant_indirectly_struct_like {
160 use super::Enum2::Struct as Variant;
162 use super::Enum2::Struct2 as Variant;
164 #[rustc_clean(cfg="cfail2", except="HirBody,optimized_mir,mir_built")]
165 #[rustc_clean(cfg="cfail3")]
166 pub fn function() -> Enum2 {
176 // Change field value (tuple-like) -------------------------------------------
178 pub fn change_field_value_tuple_like() -> Enum {
183 #[rustc_clean(cfg="cfail2", except="HirBody,optimized_mir,mir_built")]
184 #[rustc_clean(cfg="cfail3")]
185 pub fn change_field_value_tuple_like() -> Enum {
191 // Change constructor path (tuple-like) --------------------------------------
193 pub fn change_constructor_path_tuple_like() {
194 let _ = Enum::Tuple(0, 1, 2);
200 except="HirBody,optimized_mir,mir_built,typeck_tables_of"
202 #[rustc_clean(cfg="cfail3")]
203 pub fn change_constructor_path_tuple_like() {
204 let _ = Enum2::Tuple(0, 1, 2);
209 // Change constructor variant (tuple-like) --------------------------------------
211 pub fn change_constructor_variant_tuple_like() {
212 let _ = Enum2::Tuple(0, 1, 2);
218 except="HirBody,optimized_mir,mir_built,typeck_tables_of"
220 #[rustc_clean(cfg="cfail3")]
221 pub fn change_constructor_variant_tuple_like() {
222 let _ = Enum2::Tuple2(0, 1, 2);
226 // Change constructor path indirectly (tuple-like) ---------------------------
227 pub mod change_constructor_path_indirectly_tuple_like {
229 use super::Enum as TheEnum;
231 use super::Enum2 as TheEnum;
235 except="fn_sig,Hir,HirBody,optimized_mir,mir_built,\
238 #[rustc_clean(cfg="cfail3")]
239 pub fn function() -> TheEnum {
240 TheEnum::Tuple(0, 1, 2)
246 // Change constructor variant indirectly (tuple-like) ---------------------------
247 pub mod change_constructor_variant_indirectly_tuple_like {
250 use super::Enum2::Tuple as Variant;
252 use super::Enum2::Tuple2 as Variant;
254 #[rustc_clean(cfg="cfail2", except="HirBody,optimized_mir,mir_built,typeck_tables_of")]
255 #[rustc_clean(cfg="cfail3")]
256 pub fn function() -> Enum2 {
274 // Change constructor path (C-like) --------------------------------------
276 pub fn change_constructor_path_c_like() {
281 #[rustc_clean(cfg="cfail2", except="HirBody,optimized_mir,mir_built,typeck_tables_of")]
282 #[rustc_clean(cfg="cfail3")]
283 pub fn change_constructor_path_c_like() {
289 // Change constructor variant (C-like) --------------------------------------
291 pub fn change_constructor_variant_c_like() {
296 #[rustc_clean(cfg="cfail2", except="HirBody,optimized_mir,mir_built")]
297 #[rustc_clean(cfg="cfail3")]
298 pub fn change_constructor_variant_c_like() {
303 // Change constructor path indirectly (C-like) ---------------------------
304 pub mod change_constructor_path_indirectly_c_like {
306 use super::Clike as TheEnum;
308 use super::Clike2 as TheEnum;
312 except="fn_sig,Hir,HirBody,optimized_mir,mir_built,\
315 #[rustc_clean(cfg="cfail3")]
316 pub fn function() -> TheEnum {
323 // Change constructor variant indirectly (C-like) ---------------------------
324 pub mod change_constructor_variant_indirectly_c_like {
327 use super::Clike::A as Variant;
329 use super::Clike::B as Variant;
331 #[rustc_clean(cfg="cfail2", except="HirBody,optimized_mir,mir_built")]
332 #[rustc_clean(cfg="cfail3")]
333 pub fn function() -> Clike {