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
14 // [cfail4]compile-flags: -Zincremental-relative-spans
15 // [cfail5]compile-flags: -Zincremental-relative-spans
16 // [cfail6]compile-flags: -Zincremental-relative-spans
19 #![feature(rustc_attrs)]
21 #![feature(thread_local)]
25 // Change static visibility
26 #[cfg(any(cfail1,cfail4))]
27 static STATIC_VISIBILITY
: u8 = 0;
29 #[cfg(not(any(cfail1,cfail4)))]
30 #[rustc_clean(cfg="cfail2")]
31 #[rustc_clean(cfg="cfail3")]
32 #[rustc_clean(cfg="cfail5", except="hir_owner,hir_owner_nodes")]
33 #[rustc_clean(cfg="cfail6")]
34 pub static STATIC_VISIBILITY
: u8 = 0;
37 // Change static mutability
38 #[cfg(any(cfail1,cfail4))]
39 static STATIC_MUTABILITY
: u8 = 0;
41 #[cfg(not(any(cfail1,cfail4)))]
42 #[rustc_clean(cfg="cfail2", except="hir_owner,hir_owner_nodes")]
43 #[rustc_clean(cfg="cfail3")]
44 #[rustc_clean(cfg="cfail5", except="hir_owner,hir_owner_nodes")]
45 #[rustc_clean(cfg="cfail6")]
46 static mut STATIC_MUTABILITY
: u8 = 0;
49 // Add linkage attribute
50 #[cfg(any(cfail1,cfail4))]
51 static STATIC_LINKAGE
: u8 = 0;
53 #[cfg(not(any(cfail1,cfail4)))]
54 #[rustc_clean(cfg="cfail2")]
55 #[rustc_clean(cfg="cfail3")]
56 #[rustc_clean(cfg="cfail5")]
57 #[rustc_clean(cfg="cfail6")]
59 static STATIC_LINKAGE
: u8 = 0;
62 // Add no_mangle attribute
63 #[cfg(any(cfail1,cfail4))]
64 static STATIC_NO_MANGLE
: u8 = 0;
66 #[cfg(not(any(cfail1,cfail4)))]
67 #[rustc_clean(cfg="cfail2")]
68 #[rustc_clean(cfg="cfail3")]
69 #[rustc_clean(cfg="cfail5")]
70 #[rustc_clean(cfg="cfail6")]
72 static STATIC_NO_MANGLE
: u8 = 0;
75 // Add thread_local attribute
76 #[cfg(any(cfail1,cfail4))]
77 static STATIC_THREAD_LOCAL
: u8 = 0;
79 #[cfg(not(any(cfail1,cfail4)))]
80 #[rustc_clean(cfg="cfail2")]
81 #[rustc_clean(cfg="cfail3")]
82 #[rustc_clean(cfg="cfail5")]
83 #[rustc_clean(cfg="cfail6")]
85 static STATIC_THREAD_LOCAL
: u8 = 0;
88 // Change type from i16 to u64
89 #[cfg(any(cfail1,cfail4))]
90 static STATIC_CHANGE_TYPE_1
: i16 = 0;
92 #[cfg(not(any(cfail1,cfail4)))]
93 #[rustc_clean(cfg="cfail2", except="hir_owner,hir_owner_nodes,type_of")]
94 #[rustc_clean(cfg="cfail3")]
95 #[rustc_clean(cfg="cfail5", except="hir_owner,hir_owner_nodes,type_of")]
96 #[rustc_clean(cfg="cfail6")]
97 static STATIC_CHANGE_TYPE_1
: u64 = 0;
100 // Change type from Option<i8> to Option<u16>
101 #[cfg(any(cfail1,cfail4))]
102 static STATIC_CHANGE_TYPE_2
: Option
<i8> = None
;
104 #[cfg(not(any(cfail1,cfail4)))]
105 #[rustc_clean(cfg="cfail2", except="hir_owner,hir_owner_nodes,type_of")]
106 #[rustc_clean(cfg="cfail3")]
107 #[rustc_clean(cfg="cfail5", except="hir_owner,hir_owner_nodes,type_of")]
108 #[rustc_clean(cfg="cfail6")]
109 static STATIC_CHANGE_TYPE_2
: Option
<u16> = None
;
112 // Change value between simple literals
113 #[rustc_clean(cfg="cfail2", except="hir_owner_nodes")]
114 #[rustc_clean(cfg="cfail3")]
115 #[rustc_clean(cfg="cfail5", except="hir_owner_nodes")]
116 #[rustc_clean(cfg="cfail6")]
117 static STATIC_CHANGE_VALUE_1
: i16 = {
118 #[cfg(any(cfail1,cfail4))]
121 #[cfg(not(any(cfail1,cfail4)))]
126 // Change value between expressions
127 #[rustc_clean(cfg="cfail2", except="hir_owner_nodes")]
128 #[rustc_clean(cfg="cfail3")]
129 #[rustc_clean(cfg="cfail5", except="hir_owner_nodes")]
130 #[rustc_clean(cfg="cfail6")]
131 static STATIC_CHANGE_VALUE_2
: i16 = {
132 #[cfg(any(cfail1,cfail4))]
135 #[cfg(not(any(cfail1,cfail4)))]
139 #[rustc_clean(cfg="cfail2", except="hir_owner_nodes")]
140 #[rustc_clean(cfg="cfail3")]
141 #[rustc_clean(cfg="cfail5", except="hir_owner_nodes")]
142 #[rustc_clean(cfg="cfail6")]
143 static STATIC_CHANGE_VALUE_3
: i16 = {
144 #[cfg(any(cfail1,cfail4))]
147 #[cfg(not(any(cfail1,cfail4)))]
151 #[rustc_clean(cfg="cfail2", except="hir_owner_nodes")]
152 #[rustc_clean(cfg="cfail3")]
153 #[rustc_clean(cfg="cfail5", except="hir_owner_nodes")]
154 #[rustc_clean(cfg="cfail6")]
155 static STATIC_CHANGE_VALUE_4
: i16 = {
156 #[cfg(any(cfail1,cfail4))]
159 #[cfg(not(any(cfail1,cfail4)))]
164 // Change type indirectly
165 struct ReferencedType1
;
166 struct ReferencedType2
;
168 mod static_change_type_indirectly
{
169 #[cfg(any(cfail1,cfail4))]
170 use super::ReferencedType1
as Type
;
172 #[cfg(not(any(cfail1,cfail4)))]
173 use super::ReferencedType2
as Type
;
175 #[rustc_clean(cfg="cfail2", except="hir_owner,hir_owner_nodes,type_of")]
176 #[rustc_clean(cfg="cfail3")]
177 #[rustc_clean(cfg="cfail5", except="hir_owner,hir_owner_nodes,type_of")]
178 #[rustc_clean(cfg="cfail6")]
179 static STATIC_CHANGE_TYPE_INDIRECTLY_1
: Type
= Type
;
181 #[rustc_clean(cfg="cfail2", except="hir_owner,hir_owner_nodes,type_of")]
182 #[rustc_clean(cfg="cfail3")]
183 #[rustc_clean(cfg="cfail5", except="hir_owner,hir_owner_nodes,type_of")]
184 #[rustc_clean(cfg="cfail6")]
185 static STATIC_CHANGE_TYPE_INDIRECTLY_2
: Option
<Type
> = None
;