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.
20 // revisions: cfail1 cfail2 cfail3
21 // compile-flags: -Z query-dep-graph -Zincremental-ignore-spans
24 #![feature(rustc_attrs)]
28 // Change const visibility ---------------------------------------------------
30 const CONST_VISIBILITY: u8 = 0;
33 #[rustc_clean(cfg="cfail2", except="Hir,HirBody")]
34 #[rustc_clean(cfg="cfail3")]
35 pub const CONST_VISIBILITY: u8 = 0;
38 // Change type from i32 to u32 ------------------------------------------------
40 const CONST_CHANGE_TYPE_1: i32 = 0;
43 #[rustc_clean(cfg="cfail2", except="Hir,HirBody,TypeOfItem")]
44 #[rustc_clean(cfg="cfail3")]
45 const CONST_CHANGE_TYPE_1: u32 = 0;
48 // Change type from Option<u32> to Option<u64> --------------------------------
50 const CONST_CHANGE_TYPE_2: Option<u32> = None;
53 #[rustc_clean(cfg="cfail2", except="Hir,HirBody,TypeOfItem")]
54 #[rustc_clean(cfg="cfail3")]
55 const CONST_CHANGE_TYPE_2: Option<u64> = None;
58 // Change value between simple literals ---------------------------------------
59 #[rustc_clean(cfg="cfail2", except="HirBody")]
60 #[rustc_clean(cfg="cfail3")]
61 const CONST_CHANGE_VALUE_1: i16 = {
70 // Change value between expressions -------------------------------------------
71 #[rustc_clean(cfg="cfail2", except="HirBody")]
72 #[rustc_clean(cfg="cfail3")]
73 const CONST_CHANGE_VALUE_2: i16 = {
81 #[rustc_clean(cfg="cfail2", except="HirBody")]
82 #[rustc_clean(cfg="cfail3")]
83 const CONST_CHANGE_VALUE_3: i16 = {
91 #[rustc_clean(cfg="cfail2", except="HirBody")]
92 #[rustc_clean(cfg="cfail3")]
93 const CONST_CHANGE_VALUE_4: i16 = {
102 // Change type indirectly -----------------------------------------------------
103 struct ReferencedType1;
104 struct ReferencedType2;
106 mod const_change_type_indirectly {
108 use super::ReferencedType1 as Type;
111 use super::ReferencedType2 as Type;
113 #[rustc_clean(cfg="cfail2", except="Hir,HirBody,TypeOfItem")]
114 #[rustc_clean(cfg="cfail3")]
115 const CONST_CHANGE_TYPE_INDIRECTLY_1: Type = Type;
117 #[rustc_clean(cfg="cfail2", except="Hir,HirBody,TypeOfItem")]
118 #[rustc_clean(cfg="cfail3")]
119 const CONST_CHANGE_TYPE_INDIRECTLY_2: Option<Type> = None;