1 // This test case tests the incremental compilation hash (ICH) implementation
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 -O
13 #![feature(rustc_attrs)]
17 // Change const visibility
19 const CONST_VISIBILITY: u8 = 0;
22 #[rustc_clean(cfg="cfail2", except="hir_owner,hir_owner_nodes")]
23 #[rustc_clean(cfg="cfail3")]
24 pub const CONST_VISIBILITY: u8 = 0;
27 // Change type from i32 to u32
29 const CONST_CHANGE_TYPE_1: i32 = 0;
32 #[rustc_clean(cfg="cfail2", except="hir_owner,hir_owner_nodes,type_of")]
33 #[rustc_clean(cfg="cfail3")]
34 const CONST_CHANGE_TYPE_1: u32 = 0;
37 // Change type from Option<u32> to Option<u64>
39 const CONST_CHANGE_TYPE_2: Option<u32> = None;
42 #[rustc_clean(cfg="cfail2", except="hir_owner,hir_owner_nodes,type_of")]
43 #[rustc_clean(cfg="cfail3")]
44 const CONST_CHANGE_TYPE_2: Option<u64> = None;
47 // Change value between simple literals
48 #[rustc_clean(cfg="cfail2", except="hir_owner_nodes")]
49 #[rustc_clean(cfg="cfail3")]
50 const CONST_CHANGE_VALUE_1: i16 = {
59 // Change value between expressions
60 #[rustc_clean(cfg="cfail2", except="hir_owner_nodes")]
61 #[rustc_clean(cfg="cfail3")]
62 const CONST_CHANGE_VALUE_2: i16 = {
70 #[rustc_clean(cfg="cfail2", except="hir_owner_nodes")]
71 #[rustc_clean(cfg="cfail3")]
72 const CONST_CHANGE_VALUE_3: i16 = {
80 #[rustc_clean(cfg="cfail2", except="hir_owner_nodes")]
81 #[rustc_clean(cfg="cfail3")]
82 const CONST_CHANGE_VALUE_4: i16 = {
91 // Change type indirectly
92 struct ReferencedType1;
93 struct ReferencedType2;
95 mod const_change_type_indirectly {
97 use super::ReferencedType1 as Type;
100 use super::ReferencedType2 as Type;
102 #[rustc_clean(cfg="cfail2", except="hir_owner,hir_owner_nodes,type_of")]
103 #[rustc_clean(cfg="cfail3")]
104 const CONST_CHANGE_TYPE_INDIRECTLY_1: Type = Type;
106 #[rustc_clean(cfg="cfail2", except="hir_owner,hir_owner_nodes,type_of")]
107 #[rustc_clean(cfg="cfail3")]
108 const CONST_CHANGE_TYPE_INDIRECTLY_2: Option<Type> = None;