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 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)]
18 #![feature(thread_local)]
22 // Change static visibility
23 #[cfg(any(cfail1,cfail4))]
24 static STATIC_VISIBILITY: u8 = 0;
26 #[cfg(not(any(cfail1,cfail4)))]
27 #[rustc_clean(cfg="cfail2")]
28 #[rustc_clean(cfg="cfail3")]
29 #[rustc_clean(cfg="cfail5", except="hir_owner,hir_owner_nodes")]
30 #[rustc_clean(cfg="cfail6")]
31 pub static STATIC_VISIBILITY: u8 = 0;
34 // Change static mutability
35 #[cfg(any(cfail1,cfail4))]
36 static STATIC_MUTABILITY: u8 = 0;
38 #[cfg(not(any(cfail1,cfail4)))]
39 #[rustc_clean(cfg="cfail2", except="hir_owner,hir_owner_nodes")]
40 #[rustc_clean(cfg="cfail3")]
41 #[rustc_clean(cfg="cfail5", except="hir_owner,hir_owner_nodes")]
42 #[rustc_clean(cfg="cfail6")]
43 static mut STATIC_MUTABILITY: u8 = 0;
46 // Add linkage attribute
47 #[cfg(any(cfail1,cfail4))]
48 static STATIC_LINKAGE: u8 = 0;
50 #[cfg(not(any(cfail1,cfail4)))]
51 #[rustc_clean(cfg="cfail2")]
52 #[rustc_clean(cfg="cfail3")]
53 #[rustc_clean(cfg="cfail5")]
54 #[rustc_clean(cfg="cfail6")]
56 static STATIC_LINKAGE: u8 = 0;
59 // Add no_mangle attribute
60 #[cfg(any(cfail1,cfail4))]
61 static STATIC_NO_MANGLE: u8 = 0;
63 #[cfg(not(any(cfail1,cfail4)))]
64 #[rustc_clean(cfg="cfail2")]
65 #[rustc_clean(cfg="cfail3")]
66 #[rustc_clean(cfg="cfail5")]
67 #[rustc_clean(cfg="cfail6")]
69 static STATIC_NO_MANGLE: u8 = 0;
72 // Add thread_local attribute
73 #[cfg(any(cfail1,cfail4))]
74 static STATIC_THREAD_LOCAL: u8 = 0;
76 #[cfg(not(any(cfail1,cfail4)))]
77 #[rustc_clean(cfg="cfail2")]
78 #[rustc_clean(cfg="cfail3")]
79 #[rustc_clean(cfg="cfail5")]
80 #[rustc_clean(cfg="cfail6")]
82 static STATIC_THREAD_LOCAL: u8 = 0;
85 // Change type from i16 to u64
86 #[cfg(any(cfail1,cfail4))]
87 static STATIC_CHANGE_TYPE_1: i16 = 0;
89 #[cfg(not(any(cfail1,cfail4)))]
90 #[rustc_clean(cfg="cfail2", except="hir_owner,hir_owner_nodes,type_of")]
91 #[rustc_clean(cfg="cfail3")]
92 #[rustc_clean(cfg="cfail5", except="hir_owner,hir_owner_nodes,type_of")]
93 #[rustc_clean(cfg="cfail6")]
94 static STATIC_CHANGE_TYPE_1: u64 = 0;
97 // Change type from Option<i8> to Option<u16>
98 #[cfg(any(cfail1,cfail4))]
99 static STATIC_CHANGE_TYPE_2: Option<i8> = None;
101 #[cfg(not(any(cfail1,cfail4)))]
102 #[rustc_clean(cfg="cfail2", except="hir_owner,hir_owner_nodes,type_of")]
103 #[rustc_clean(cfg="cfail3")]
104 #[rustc_clean(cfg="cfail5", except="hir_owner,hir_owner_nodes,type_of")]
105 #[rustc_clean(cfg="cfail6")]
106 static STATIC_CHANGE_TYPE_2: Option<u16> = None;
109 // Change value between simple literals
110 #[rustc_clean(cfg="cfail2", except="hir_owner_nodes")]
111 #[rustc_clean(cfg="cfail3")]
112 #[rustc_clean(cfg="cfail5", except="hir_owner_nodes")]
113 #[rustc_clean(cfg="cfail6")]
114 static STATIC_CHANGE_VALUE_1: i16 = {
115 #[cfg(any(cfail1,cfail4))]
118 #[cfg(not(any(cfail1,cfail4)))]
123 // Change value between expressions
124 #[rustc_clean(cfg="cfail2", except="hir_owner_nodes")]
125 #[rustc_clean(cfg="cfail3")]
126 #[rustc_clean(cfg="cfail5", except="hir_owner_nodes")]
127 #[rustc_clean(cfg="cfail6")]
128 static STATIC_CHANGE_VALUE_2: i16 = {
129 #[cfg(any(cfail1,cfail4))]
132 #[cfg(not(any(cfail1,cfail4)))]
136 #[rustc_clean(cfg="cfail2", except="hir_owner_nodes")]
137 #[rustc_clean(cfg="cfail3")]
138 #[rustc_clean(cfg="cfail5", except="hir_owner_nodes")]
139 #[rustc_clean(cfg="cfail6")]
140 static STATIC_CHANGE_VALUE_3: i16 = {
141 #[cfg(any(cfail1,cfail4))]
144 #[cfg(not(any(cfail1,cfail4)))]
148 #[rustc_clean(cfg="cfail2", except="hir_owner_nodes")]
149 #[rustc_clean(cfg="cfail3")]
150 #[rustc_clean(cfg="cfail5", except="hir_owner_nodes")]
151 #[rustc_clean(cfg="cfail6")]
152 static STATIC_CHANGE_VALUE_4: i16 = {
153 #[cfg(any(cfail1,cfail4))]
156 #[cfg(not(any(cfail1,cfail4)))]
161 // Change type indirectly
162 struct ReferencedType1;
163 struct ReferencedType2;
165 mod static_change_type_indirectly {
166 #[cfg(any(cfail1,cfail4))]
167 use super::ReferencedType1 as Type;
169 #[cfg(not(any(cfail1,cfail4)))]
170 use super::ReferencedType2 as Type;
172 #[rustc_clean(cfg="cfail2", except="hir_owner,hir_owner_nodes,type_of")]
173 #[rustc_clean(cfg="cfail3")]
174 #[rustc_clean(cfg="cfail5", except="hir_owner,hir_owner_nodes,type_of")]
175 #[rustc_clean(cfg="cfail6")]
176 static STATIC_CHANGE_TYPE_INDIRECTLY_1: Type = Type;
178 #[rustc_clean(cfg="cfail2", except="hir_owner,hir_owner_nodes,type_of")]
179 #[rustc_clean(cfg="cfail3")]
180 #[rustc_clean(cfg="cfail5", except="hir_owner,hir_owner_nodes,type_of")]
181 #[rustc_clean(cfg="cfail6")]
182 static STATIC_CHANGE_TYPE_INDIRECTLY_2: Option<Type> = None;