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)]
17 pub struct RegularStruct {
23 // Change field value (regular struct)
25 pub fn change_field_value_regular_struct() -> RegularStruct {
34 #[rustc_clean(cfg="cfail2", except="hir_owner_nodes,optimized_mir")]
35 #[rustc_clean(cfg="cfail3")]
36 pub fn change_field_value_regular_struct() -> RegularStruct {
46 // Change field order (regular struct)
48 pub fn change_field_order_regular_struct() -> RegularStruct {
57 #[rustc_clean(cfg="cfail2", except="hir_owner_nodes,typeck")]
58 #[rustc_clean(cfg="cfail3")]
59 pub fn change_field_order_regular_struct() -> RegularStruct {
69 // Add field (regular struct)
71 pub fn add_field_regular_struct() -> RegularStruct {
72 let struct1 = RegularStruct {
85 #[rustc_clean(cfg="cfail2", except="hir_owner_nodes,optimized_mir,typeck")]
86 #[rustc_clean(cfg="cfail3")]
87 pub fn add_field_regular_struct() -> RegularStruct {
88 let struct1 = RegularStruct {
103 // Change field label (regular struct)
105 pub fn change_field_label_regular_struct() -> RegularStruct {
106 let struct1 = RegularStruct {
120 #[rustc_clean(cfg="cfail2", except="hir_owner_nodes,optimized_mir,typeck")]
121 #[rustc_clean(cfg="cfail3")]
122 pub fn change_field_label_regular_struct() -> RegularStruct {
123 let struct1 = RegularStruct {
138 pub struct RegularStruct2 {
144 // Change constructor path (regular struct)
146 pub fn change_constructor_path_regular_struct() {
147 let _ = RegularStruct {
155 #[rustc_clean(cfg="cfail2", except="hir_owner_nodes,typeck")]
156 #[rustc_clean(cfg="cfail3")]
157 pub fn change_constructor_path_regular_struct() {
158 let _ = RegularStruct2 {
167 // Change constructor path indirectly (regular struct)
168 pub mod change_constructor_path_indirectly_regular_struct {
170 use super::RegularStruct as Struct;
172 use super::RegularStruct2 as Struct;
176 except="fn_sig,hir_owner,hir_owner_nodes,optimized_mir,typeck"
178 #[rustc_clean(cfg="cfail3")]
179 pub fn function() -> Struct {
190 pub struct TupleStruct(i32, i64, i16);
192 // Change field value (tuple struct)
194 pub fn change_field_value_tuple_struct() -> TupleStruct {
199 #[rustc_clean(cfg="cfail2", except="hir_owner_nodes,optimized_mir")]
200 #[rustc_clean(cfg="cfail3")]
201 pub fn change_field_value_tuple_struct() -> TupleStruct {
207 pub struct TupleStruct2(u16, u16, u16);
209 // Change constructor path (tuple struct)
211 pub fn change_constructor_path_tuple_struct() {
212 let _ = TupleStruct(0, 1, 2);
216 #[rustc_clean(cfg="cfail2", except="hir_owner_nodes,typeck")]
217 #[rustc_clean(cfg="cfail3")]
218 pub fn change_constructor_path_tuple_struct() {
219 let _ = TupleStruct2(0, 1, 2);
224 // Change constructor path indirectly (tuple struct)
225 pub mod change_constructor_path_indirectly_tuple_struct {
227 use super::TupleStruct as Struct;
229 use super::TupleStruct2 as Struct;
233 except="fn_sig,hir_owner,hir_owner_nodes,optimized_mir,typeck"
235 #[rustc_clean(cfg="cfail3")]
236 pub fn function() -> Struct {