1 // Copyright 2016 The Rust Project Developers. See the COPYRIGHT
2 // file at the top-level directory of this distribution and at
3 // http://rust-lang.org/COPYRIGHT.
5 // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6 // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7 // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8 // option. This file may not be copied, modified, or distributed
9 // except according to those terms.
12 // This test case tests the incremental compilation hash (ICH) implementation
15 // The general pattern followed here is: Change one thing between rev1 and rev2
16 // and make sure that the hash has changed, then change nothing between rev2 and
17 // rev3 and make sure that the hash has not changed.
19 // must-compile-successfully
20 // revisions: cfail1 cfail2 cfail3
21 // compile-flags: -Z query-dep-graph
24 #![feature(rustc_attrs)]
26 #![feature(thread_local)]
30 // Change static visibility ---------------------------------------------------
32 static STATIC_VISIBILITY: u8 = 0;
35 #[rustc_clean(cfg="cfail2", except="Hir,HirBody")]
36 #[rustc_clean(cfg="cfail3")]
37 #[rustc_metadata_dirty(cfg="cfail2")]
38 #[rustc_metadata_clean(cfg="cfail3")]
39 pub static STATIC_VISIBILITY: u8 = 0;
42 // Change static mutability ---------------------------------------------------
44 static STATIC_MUTABILITY: u8 = 0;
47 #[rustc_clean(cfg="cfail2", except="Hir,HirBody")]
48 #[rustc_clean(cfg="cfail3")]
49 #[rustc_metadata_dirty(cfg="cfail2")]
50 #[rustc_metadata_clean(cfg="cfail3")]
51 static mut STATIC_MUTABILITY: u8 = 0;
54 // Add linkage attribute ------------------------------------------------------
56 static STATIC_LINKAGE: u8 = 0;
59 #[rustc_clean(cfg="cfail2", except="Hir,HirBody")]
60 #[rustc_clean(cfg="cfail3")]
61 #[rustc_metadata_dirty(cfg="cfail2")]
62 #[rustc_metadata_clean(cfg="cfail3")]
64 static STATIC_LINKAGE: u8 = 0;
67 // Add no_mangle attribute ----------------------------------------------------
69 static STATIC_NO_MANGLE: u8 = 0;
72 #[rustc_clean(cfg="cfail2", except="Hir,HirBody")]
73 #[rustc_clean(cfg="cfail3")]
74 #[rustc_metadata_dirty(cfg="cfail2")]
75 #[rustc_metadata_clean(cfg="cfail3")]
77 static STATIC_NO_MANGLE: u8 = 0;
80 // Add thread_local attribute -------------------------------------------------
82 static STATIC_THREAD_LOCAL: u8 = 0;
85 #[rustc_clean(cfg="cfail2", except="Hir,HirBody")]
86 #[rustc_clean(cfg="cfail3")]
87 #[rustc_metadata_dirty(cfg="cfail2")]
88 #[rustc_metadata_clean(cfg="cfail3")]
90 static STATIC_THREAD_LOCAL: u8 = 0;
93 // Change type from i16 to u64 ------------------------------------------------
95 static STATIC_CHANGE_TYPE_1: i16 = 0;
98 #[rustc_clean(cfg="cfail2", except="Hir,HirBody,TypeOfItem")]
99 #[rustc_clean(cfg="cfail3")]
100 #[rustc_metadata_dirty(cfg="cfail2")]
101 #[rustc_metadata_clean(cfg="cfail3")]
102 static STATIC_CHANGE_TYPE_1: u64 = 0;
105 // Change type from Option<i8> to Option<u16> ---------------------------------
107 static STATIC_CHANGE_TYPE_2: Option<i8> = None;
110 #[rustc_clean(cfg="cfail2", except="Hir,HirBody,TypeOfItem")]
111 #[rustc_clean(cfg="cfail3")]
112 #[rustc_metadata_dirty(cfg="cfail2")]
113 #[rustc_metadata_clean(cfg="cfail3")]
114 static STATIC_CHANGE_TYPE_2: Option<u16> = None;
117 // Change value between simple literals ---------------------------------------
118 #[rustc_clean(cfg="cfail2", except="HirBody")]
119 #[rustc_clean(cfg="cfail3")]
120 #[rustc_metadata_clean(cfg="cfail2")]
121 #[rustc_metadata_clean(cfg="cfail3")]
122 static STATIC_CHANGE_VALUE_1: i16 = {
131 // Change value between expressions -------------------------------------------
132 #[rustc_clean(cfg="cfail2", except="HirBody")]
133 #[rustc_clean(cfg="cfail3")]
134 #[rustc_metadata_clean(cfg="cfail2")]
135 #[rustc_metadata_clean(cfg="cfail3")]
136 static STATIC_CHANGE_VALUE_2: i16 = {
144 #[rustc_clean(cfg="cfail2", except="HirBody")]
145 #[rustc_clean(cfg="cfail3")]
146 #[rustc_metadata_clean(cfg="cfail2")]
147 #[rustc_metadata_clean(cfg="cfail3")]
148 static STATIC_CHANGE_VALUE_3: i16 = {
156 #[rustc_clean(cfg="cfail2", except="HirBody")]
157 #[rustc_clean(cfg="cfail3")]
158 #[rustc_metadata_clean(cfg="cfail2")]
159 #[rustc_metadata_clean(cfg="cfail3")]
160 static STATIC_CHANGE_VALUE_4: i16 = {
169 // Change type indirectly -----------------------------------------------------
170 struct ReferencedType1;
171 struct ReferencedType2;
173 mod static_change_type_indirectly {
175 use super::ReferencedType1 as Type;
178 use super::ReferencedType2 as Type;
180 #[rustc_clean(cfg="cfail2", except="Hir,HirBody,TypeOfItem")]
181 #[rustc_clean(cfg="cfail3")]
182 #[rustc_metadata_dirty(cfg="cfail2")]
183 #[rustc_metadata_clean(cfg="cfail3")]
184 static STATIC_CHANGE_TYPE_INDIRECTLY_1: Type = Type;
186 #[rustc_clean(cfg="cfail2", except="Hir,HirBody,TypeOfItem")]
187 #[rustc_clean(cfg="cfail3")]
188 #[rustc_metadata_dirty(cfg="cfail2")]
189 #[rustc_metadata_clean(cfg="cfail3")]
190 static STATIC_CHANGE_TYPE_INDIRECTLY_2: Option<Type> = None;