]> git.lizzy.rs Git - rust.git/blob - src/test/incremental/hashes/let_expressions.rs
Merge pull request #2 from rust-lang/master
[rust.git] / src / test / incremental / hashes / let_expressions.rs
1 // This test case tests the incremental compilation hash (ICH) implementation
2 // for let expressions.
3
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.
7
8 // build-pass (FIXME(62277): could be check-pass?)
9 // revisions: cfail1 cfail2 cfail3
10 // compile-flags: -Z query-dep-graph -Zincremental-ignore-spans
11
12
13 #![allow(warnings)]
14 #![feature(rustc_attrs)]
15 #![crate_type="rlib"]
16
17 // Change Name -----------------------------------------------------------------
18 #[cfg(cfail1)]
19 pub fn change_name() {
20     let _x = 2u64;
21 }
22
23 #[cfg(not(cfail1))]
24 #[rustc_clean(cfg="cfail2",
25     except="hir_owner_nodes,mir_built,optimized_mir")]
26 #[rustc_clean(cfg="cfail3")]
27 pub fn change_name() {
28     let _y = 2u64;
29 }
30
31
32
33 // Add Type --------------------------------------------------------------------
34 #[cfg(cfail1)]
35 pub fn add_type() {
36     let _x = 2u32;
37 }
38
39 #[cfg(not(cfail1))]
40 #[rustc_clean(cfg="cfail2",
41     except="hir_owner_nodes,typeck_tables_of,mir_built")]
42 #[rustc_clean(cfg="cfail3")]
43 pub fn add_type() {
44     let _x: u32 = 2u32;
45 }
46
47
48
49 // Change Type -----------------------------------------------------------------
50 #[cfg(cfail1)]
51 pub fn change_type() {
52     let _x: u64 = 2;
53 }
54
55 #[cfg(not(cfail1))]
56 #[rustc_clean(cfg="cfail2",
57     except="hir_owner_nodes,typeck_tables_of,mir_built,optimized_mir")]
58 #[rustc_clean(cfg="cfail3")]
59 pub fn change_type() {
60     let _x: u8 = 2;
61 }
62
63
64
65 // Change Mutability of Reference Type -----------------------------------------
66 #[cfg(cfail1)]
67 pub fn change_mutability_of_reference_type() {
68     let _x: &u64;
69 }
70
71 #[cfg(not(cfail1))]
72 #[rustc_clean(cfg="cfail2",
73     except="hir_owner_nodes,typeck_tables_of,mir_built,optimized_mir")]
74 #[rustc_clean(cfg="cfail3")]
75 pub fn change_mutability_of_reference_type() {
76     let _x: &mut u64;
77 }
78
79
80
81 // Change Mutability of Slot ---------------------------------------------------
82 #[cfg(cfail1)]
83 pub fn change_mutability_of_slot() {
84     let mut _x: u64 = 0;
85 }
86
87 #[cfg(not(cfail1))]
88 #[rustc_clean(cfg="cfail2",
89     except="hir_owner_nodes,typeck_tables_of,mir_built,optimized_mir")]
90 #[rustc_clean(cfg="cfail3")]
91 pub fn change_mutability_of_slot() {
92     let _x: u64 = 0;
93 }
94
95
96
97 // Change Simple Binding to Pattern --------------------------------------------
98 #[cfg(cfail1)]
99 pub fn change_simple_binding_to_pattern() {
100     let _x = (0u8, 'x');
101 }
102
103 #[cfg(not(cfail1))]
104 #[rustc_clean(cfg="cfail2",
105     except="hir_owner_nodes,typeck_tables_of,mir_built,optimized_mir")]
106 #[rustc_clean(cfg="cfail3")]
107 pub fn change_simple_binding_to_pattern() {
108     let (_a, _b) = (0u8, 'x');
109 }
110
111
112
113 // Change Name in Pattern ------------------------------------------------------
114 #[cfg(cfail1)]
115 pub fn change_name_in_pattern() {
116     let (_a, _b) = (1u8, 'y');
117 }
118
119 #[cfg(not(cfail1))]
120 #[rustc_clean(cfg="cfail2",
121     except="hir_owner_nodes,mir_built,optimized_mir")]
122 #[rustc_clean(cfg="cfail3")]
123 pub fn change_name_in_pattern() {
124     let (_a, _c) = (1u8, 'y');
125 }
126
127
128
129 // Add `ref` in Pattern --------------------------------------------------------
130 #[cfg(cfail1)]
131 pub fn add_ref_in_pattern() {
132     let (_a, _b) = (1u8, 'y');
133 }
134
135 #[cfg(not(cfail1))]
136 #[rustc_clean(cfg="cfail2",
137     except="hir_owner_nodes,typeck_tables_of,mir_built,optimized_mir")]
138 #[rustc_clean(cfg="cfail3")]
139 pub fn add_ref_in_pattern() {
140     let (ref _a, _b) = (1u8, 'y');
141 }
142
143
144
145 // Add `&` in Pattern ----------------------------------------------------------
146 #[cfg(cfail1)]
147 pub fn add_amp_in_pattern() {
148     let (_a, _b) = (&1u8, 'y');
149 }
150
151 #[cfg(not(cfail1))]
152 #[rustc_clean(cfg="cfail2",
153     except="hir_owner_nodes,typeck_tables_of,mir_built,optimized_mir")]
154 #[rustc_clean(cfg="cfail3")]
155 pub fn add_amp_in_pattern() {
156     let (&_a, _b) = (&1u8, 'y');
157 }
158
159
160
161 // Change Mutability of Binding in Pattern -------------------------------------
162 #[cfg(cfail1)]
163 pub fn change_mutability_of_binding_in_pattern() {
164     let (_a, _b) = (99u8, 'q');
165 }
166
167 #[cfg(not(cfail1))]
168 #[rustc_clean(cfg="cfail2",
169     except="hir_owner_nodes,typeck_tables_of,mir_built,optimized_mir")]
170 #[rustc_clean(cfg="cfail3")]
171 pub fn change_mutability_of_binding_in_pattern() {
172     let (mut _a, _b) = (99u8, 'q');
173 }
174
175
176
177 // Add Initializer -------------------------------------------------------------
178 #[cfg(cfail1)]
179 pub fn add_initializer() {
180     let _x: i16;
181 }
182
183 #[cfg(not(cfail1))]
184 #[rustc_clean(cfg="cfail2",
185     except="hir_owner_nodes,typeck_tables_of,mir_built,optimized_mir")]
186 #[rustc_clean(cfg="cfail3")]
187 pub fn add_initializer() {
188     let _x: i16 = 3i16;
189 }
190
191
192
193 // Change Initializer ----------------------------------------------------------
194 #[cfg(cfail1)]
195 pub fn change_initializer() {
196     let _x = 4u16;
197 }
198
199 #[cfg(not(cfail1))]
200 #[rustc_clean(cfg="cfail2",
201     except="hir_owner_nodes,mir_built,optimized_mir")]
202 #[rustc_clean(cfg="cfail3")]
203 pub fn change_initializer() {
204     let _x = 5u16;
205 }