1 // This test case tests the incremental compilation hash (ICH) implementation
2 // for let expressions.
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)]
19 // Change Name -----------------------------------------------------------------
20 #[cfg(any(cfail1,cfail4))]
21 pub fn change_name() {
25 #[cfg(not(any(cfail1,cfail4)))]
26 #[rustc_clean(cfg="cfail2", except="hir_owner_nodes,optimized_mir")]
27 #[rustc_clean(cfg="cfail3")]
28 #[rustc_clean(cfg="cfail5", except="hir_owner_nodes,optimized_mir")]
29 #[rustc_clean(cfg="cfail6")]
30 pub fn change_name() {
36 // Add Type --------------------------------------------------------------------
37 #[cfg(any(cfail1,cfail4))]
42 #[cfg(not(any(cfail1,cfail4)))]
43 #[rustc_clean(cfg="cfail2", except="hir_owner_nodes,typeck")]
44 #[rustc_clean(cfg="cfail3")]
45 #[rustc_clean(cfg="cfail5", except="hir_owner_nodes,typeck")]
46 #[rustc_clean(cfg="cfail6")]
53 // Change Type -----------------------------------------------------------------
54 #[cfg(any(cfail1,cfail4))]
55 pub fn change_type() {
59 #[cfg(not(any(cfail1,cfail4)))]
60 #[rustc_clean(cfg="cfail2", except="hir_owner_nodes,typeck,optimized_mir")]
61 #[rustc_clean(cfg="cfail3")]
62 #[rustc_clean(cfg="cfail5", except="hir_owner_nodes,typeck,optimized_mir")]
63 #[rustc_clean(cfg="cfail6")]
64 pub fn change_type() {
70 // Change Mutability of Reference Type -----------------------------------------
71 #[cfg(any(cfail1,cfail4))]
72 pub fn change_mutability_of_reference_type() {
76 #[cfg(not(any(cfail1,cfail4)))]
77 #[rustc_clean(cfg="cfail2", except="hir_owner_nodes,typeck,optimized_mir")]
78 #[rustc_clean(cfg="cfail3")]
79 #[rustc_clean(cfg="cfail5", except="hir_owner_nodes,typeck,optimized_mir")]
80 #[rustc_clean(cfg="cfail6")]
81 pub fn change_mutability_of_reference_type() {
87 // Change Mutability of Slot ---------------------------------------------------
88 #[cfg(any(cfail1,cfail4))]
89 pub fn change_mutability_of_slot() {
93 #[cfg(not(any(cfail1,cfail4)))]
94 #[rustc_clean(cfg="cfail2", except="hir_owner_nodes,typeck,optimized_mir")]
95 #[rustc_clean(cfg="cfail3")]
96 #[rustc_clean(cfg="cfail5", except="hir_owner_nodes,typeck,optimized_mir")]
97 #[rustc_clean(cfg="cfail6")]
98 pub fn change_mutability_of_slot() {
104 // Change Simple Binding to Pattern --------------------------------------------
105 #[cfg(any(cfail1,cfail4))]
106 pub fn change_simple_binding_to_pattern() {
110 #[cfg(not(any(cfail1,cfail4)))]
111 #[rustc_clean(cfg="cfail2", except="hir_owner_nodes,typeck,optimized_mir")]
112 #[rustc_clean(cfg="cfail3")]
113 #[rustc_clean(cfg="cfail5", except="hir_owner_nodes,typeck,optimized_mir")]
114 #[rustc_clean(cfg="cfail6")]
115 pub fn change_simple_binding_to_pattern() {
116 let (_a, _b) = (0u8, 'x');
121 // Change Name in Pattern ------------------------------------------------------
122 #[cfg(any(cfail1,cfail4))]
123 pub fn change_name_in_pattern() {
124 let (_a, _b) = (1u8, 'y');
127 #[cfg(not(any(cfail1,cfail4)))]
128 #[rustc_clean(cfg="cfail2", except="hir_owner_nodes,optimized_mir")]
129 #[rustc_clean(cfg="cfail3")]
130 #[rustc_clean(cfg="cfail5", except="hir_owner_nodes,optimized_mir")]
131 #[rustc_clean(cfg="cfail6")]
132 pub fn change_name_in_pattern() {
133 let (_a, _c) = (1u8, 'y');
138 // Add `ref` in Pattern --------------------------------------------------------
139 #[cfg(any(cfail1,cfail4))]
140 pub fn add_ref_in_pattern() {
141 let ( _a, _b) = (1u8, 'y');
144 #[cfg(not(any(cfail1,cfail4)))]
145 #[rustc_clean(cfg="cfail2", except="hir_owner_nodes,typeck,optimized_mir")]
146 #[rustc_clean(cfg="cfail3")]
147 #[rustc_clean(cfg="cfail5", except="hir_owner_nodes,typeck,optimized_mir")]
148 #[rustc_clean(cfg="cfail6")]
149 pub fn add_ref_in_pattern() {
150 let (ref _a, _b) = (1u8, 'y');
155 // Add `&` in Pattern ----------------------------------------------------------
156 #[cfg(any(cfail1,cfail4))]
157 pub fn add_amp_in_pattern() {
158 let ( _a, _b) = (&1u8, 'y');
161 #[cfg(not(any(cfail1,cfail4)))]
162 #[rustc_clean(cfg="cfail2", except="hir_owner_nodes,typeck,optimized_mir")]
163 #[rustc_clean(cfg="cfail3")]
164 #[rustc_clean(cfg="cfail5", except="hir_owner_nodes,typeck,optimized_mir")]
165 #[rustc_clean(cfg="cfail6")]
166 pub fn add_amp_in_pattern() {
167 let (&_a, _b) = (&1u8, 'y');
172 // Change Mutability of Binding in Pattern -------------------------------------
173 #[cfg(any(cfail1,cfail4))]
174 pub fn change_mutability_of_binding_in_pattern() {
175 let ( _a, _b) = (99u8, 'q');
178 #[cfg(not(any(cfail1,cfail4)))]
179 #[rustc_clean(cfg="cfail2", except="hir_owner_nodes,typeck,optimized_mir")]
180 #[rustc_clean(cfg="cfail3")]
181 #[rustc_clean(cfg="cfail5", except="hir_owner_nodes,typeck,optimized_mir")]
182 #[rustc_clean(cfg="cfail6")]
183 pub fn change_mutability_of_binding_in_pattern() {
184 let (mut _a, _b) = (99u8, 'q');
189 // Add Initializer -------------------------------------------------------------
190 #[cfg(any(cfail1,cfail4))]
191 pub fn add_initializer() {
195 #[cfg(not(any(cfail1,cfail4)))]
196 #[rustc_clean(cfg="cfail2", except="hir_owner_nodes,typeck,optimized_mir")]
197 #[rustc_clean(cfg="cfail3")]
198 #[rustc_clean(cfg="cfail5", except="hir_owner_nodes,typeck,optimized_mir")]
199 #[rustc_clean(cfg="cfail6")]
200 pub fn add_initializer() {
206 // Change Initializer ----------------------------------------------------------
207 #[cfg(any(cfail1,cfail4))]
208 pub fn change_initializer() {
212 #[cfg(not(any(cfail1,cfail4)))]
213 #[rustc_clean(cfg="cfail2", except="hir_owner_nodes")]
214 #[rustc_clean(cfg="cfail3")]
215 #[rustc_clean(cfg="cfail5", except="hir_owner_nodes")]
216 #[rustc_clean(cfg="cfail6")]
217 pub fn change_initializer() {