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 -Zincremental-ignore-spans
13 #![feature(rustc_attrs)]
15 #![feature(thread_local)]
19 // Change static visibility
21 static STATIC_VISIBILITY: u8 = 0;
24 #[rustc_clean(cfg="cfail2", except="hir_owner,hir_owner_nodes")]
25 #[rustc_clean(cfg="cfail3")]
26 pub static STATIC_VISIBILITY: u8 = 0;
29 // Change static mutability
31 static STATIC_MUTABILITY: u8 = 0;
34 #[rustc_clean(cfg="cfail2", except="hir_owner,hir_owner_nodes")]
35 #[rustc_clean(cfg="cfail3")]
36 static mut STATIC_MUTABILITY: u8 = 0;
39 // Add linkage attribute
41 static STATIC_LINKAGE: u8 = 0;
44 #[rustc_clean(cfg="cfail2", except="hir_owner,hir_owner_nodes")]
45 #[rustc_clean(cfg="cfail3")]
47 static STATIC_LINKAGE: u8 = 0;
50 // Add no_mangle attribute
52 static STATIC_NO_MANGLE: u8 = 0;
55 #[rustc_clean(cfg="cfail2", except="hir_owner,hir_owner_nodes")]
56 #[rustc_clean(cfg="cfail3")]
58 static STATIC_NO_MANGLE: u8 = 0;
61 // Add thread_local attribute
63 static STATIC_THREAD_LOCAL: u8 = 0;
66 #[rustc_clean(cfg="cfail2", except="hir_owner,hir_owner_nodes")]
67 #[rustc_clean(cfg="cfail3")]
69 static STATIC_THREAD_LOCAL: u8 = 0;
72 // Change type from i16 to u64
74 static STATIC_CHANGE_TYPE_1: i16 = 0;
77 #[rustc_clean(cfg="cfail2", except="hir_owner,hir_owner_nodes,type_of")]
78 #[rustc_clean(cfg="cfail3")]
79 static STATIC_CHANGE_TYPE_1: u64 = 0;
82 // Change type from Option<i8> to Option<u16>
84 static STATIC_CHANGE_TYPE_2: Option<i8> = None;
87 #[rustc_clean(cfg="cfail2", except="hir_owner,hir_owner_nodes,type_of")]
88 #[rustc_clean(cfg="cfail3")]
89 static STATIC_CHANGE_TYPE_2: Option<u16> = None;
92 // Change value between simple literals
93 #[rustc_clean(cfg="cfail2", except="hir_owner_nodes")]
94 #[rustc_clean(cfg="cfail3")]
95 static STATIC_CHANGE_VALUE_1: i16 = {
104 // Change value between expressions
105 #[rustc_clean(cfg="cfail2", except="hir_owner_nodes")]
106 #[rustc_clean(cfg="cfail3")]
107 static STATIC_CHANGE_VALUE_2: i16 = {
115 #[rustc_clean(cfg="cfail2", except="hir_owner_nodes")]
116 #[rustc_clean(cfg="cfail3")]
117 static STATIC_CHANGE_VALUE_3: i16 = {
125 #[rustc_clean(cfg="cfail2", except="hir_owner_nodes")]
126 #[rustc_clean(cfg="cfail3")]
127 static STATIC_CHANGE_VALUE_4: i16 = {
136 // Change type indirectly
137 struct ReferencedType1;
138 struct ReferencedType2;
140 mod static_change_type_indirectly {
142 use super::ReferencedType1 as Type;
145 use super::ReferencedType2 as Type;
147 #[rustc_clean(cfg="cfail2", except="hir_owner,hir_owner_nodes,type_of")]
148 #[rustc_clean(cfg="cfail3")]
149 static STATIC_CHANGE_TYPE_INDIRECTLY_1: Type = Type;
151 #[rustc_clean(cfg="cfail2", except="hir_owner,hir_owner_nodes,type_of")]
152 #[rustc_clean(cfg="cfail3")]
153 static STATIC_CHANGE_TYPE_INDIRECTLY_2: Option<Type> = None;