]>
git.proxmox.com Git - rustc.git/blob - src/test/incremental/hashes/unary_and_binary_exprs.rs
1 // This test case tests the incremental compilation hash (ICH) implementation
2 // for unary and binary 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
10 // compile-flags: -Z query-dep-graph -Zincremental-ignore-spans
13 #![feature(rustc_attrs)]
17 // Change constant operand of negation -----------------------------------------
19 pub fn const_negation() -> i32 {
24 #[rustc_clean(except="hir_owner_nodes,optimized_mir,mir_built", cfg="cfail2")]
25 #[rustc_clean(cfg="cfail3")]
26 pub fn const_negation() -> i32 {
32 // Change constant operand of bitwise not --------------------------------------
34 pub fn const_bitwise_not() -> i32 {
39 #[rustc_clean(except="hir_owner_nodes,optimized_mir,mir_built", cfg="cfail2")]
40 #[rustc_clean(cfg="cfail3")]
41 pub fn const_bitwise_not() -> i32 {
47 // Change variable operand of negation -----------------------------------------
49 pub fn var_negation(x
: i32, y
: i32) -> i32 {
54 #[rustc_clean(except="hir_owner_nodes,optimized_mir,mir_built", cfg="cfail2")]
55 #[rustc_clean(cfg="cfail3")]
56 pub fn var_negation(x
: i32, y
: i32) -> i32 {
62 // Change variable operand of bitwise not --------------------------------------
64 pub fn var_bitwise_not(x
: i32, y
: i32) -> i32 {
69 #[rustc_clean(except="hir_owner_nodes,optimized_mir,mir_built", cfg="cfail2")]
70 #[rustc_clean(cfg="cfail3")]
71 pub fn var_bitwise_not(x
: i32, y
: i32) -> i32 {
77 // Change variable operand of deref --------------------------------------------
79 pub fn var_deref(x
: &i32, y
: &i32) -> i32 {
84 #[rustc_clean(except="hir_owner_nodes,optimized_mir,mir_built", cfg="cfail2")]
85 #[rustc_clean(cfg="cfail3")]
86 pub fn var_deref(x
: &i32, y
: &i32) -> i32 {
92 // Change first constant operand of addition -----------------------------------
94 pub fn first_const_add() -> i32 {
99 #[rustc_clean(except="hir_owner_nodes,optimized_mir,mir_built", cfg="cfail2")]
100 #[rustc_clean(cfg="cfail3")]
101 pub fn first_const_add() -> i32 {
107 // Change second constant operand of addition -----------------------------------
109 pub fn second_const_add() -> i32 {
114 #[rustc_clean(except="hir_owner_nodes,optimized_mir,mir_built", cfg="cfail2")]
115 #[rustc_clean(cfg="cfail3")]
116 pub fn second_const_add() -> i32 {
122 // Change first variable operand of addition -----------------------------------
124 pub fn first_var_add(a
: i32, b
: i32) -> i32 {
129 #[rustc_clean(except="hir_owner_nodes,optimized_mir,mir_built", cfg="cfail2")]
130 #[rustc_clean(cfg="cfail3")]
131 pub fn first_var_add(a
: i32, b
: i32) -> i32 {
137 // Change second variable operand of addition ----------------------------------
139 pub fn second_var_add(a
: i32, b
: i32) -> i32 {
144 #[rustc_clean(except="hir_owner_nodes,optimized_mir,mir_built", cfg="cfail2")]
145 #[rustc_clean(cfg="cfail3")]
146 pub fn second_var_add(a
: i32, b
: i32) -> i32 {
152 // Change operator from + to - -------------------------------------------------
154 pub fn plus_to_minus(a
: i32) -> i32 {
159 #[rustc_clean(except="hir_owner_nodes,optimized_mir,mir_built", cfg="cfail2")]
160 #[rustc_clean(cfg="cfail3")]
161 pub fn plus_to_minus(a
: i32) -> i32 {
167 // Change operator from + to * -------------------------------------------------
169 pub fn plus_to_mult(a
: i32) -> i32 {
174 #[rustc_clean(except="hir_owner_nodes,optimized_mir,mir_built", cfg="cfail2")]
175 #[rustc_clean(cfg="cfail3")]
176 pub fn plus_to_mult(a
: i32) -> i32 {
182 // Change operator from + to / -------------------------------------------------
184 pub fn plus_to_div(a
: i32) -> i32 {
189 #[rustc_clean(except="hir_owner_nodes,optimized_mir,mir_built", cfg="cfail2")]
190 #[rustc_clean(cfg="cfail3")]
191 pub fn plus_to_div(a
: i32) -> i32 {
197 // Change operator from + to % -------------------------------------------------
199 pub fn plus_to_mod(a
: i32) -> i32 {
204 #[rustc_clean(except="hir_owner_nodes,optimized_mir,mir_built", cfg="cfail2")]
205 #[rustc_clean(cfg="cfail3")]
206 pub fn plus_to_mod(a
: i32) -> i32 {
212 // Change operator from && to || -----------------------------------------------
214 pub fn and_to_or(a
: bool
, b
: bool
) -> bool
{
219 #[rustc_clean(except="hir_owner_nodes,optimized_mir,mir_built", cfg="cfail2")]
220 #[rustc_clean(cfg="cfail3")]
221 pub fn and_to_or(a
: bool
, b
: bool
) -> bool
{
227 // Change operator from & to | -------------------------------------------------
229 pub fn bitwise_and_to_bitwise_or(a
: i32) -> i32 {
234 #[rustc_clean(except="hir_owner_nodes,optimized_mir,mir_built", cfg="cfail2")]
235 #[rustc_clean(cfg="cfail3")]
236 pub fn bitwise_and_to_bitwise_or(a
: i32) -> i32 {
242 // Change operator from & to ^ -------------------------------------------------
244 pub fn bitwise_and_to_bitwise_xor(a
: i32) -> i32 {
249 #[rustc_clean(except="hir_owner_nodes,optimized_mir,mir_built", cfg="cfail2")]
250 #[rustc_clean(cfg="cfail3")]
251 pub fn bitwise_and_to_bitwise_xor(a
: i32) -> i32 {
257 // Change operator from & to << ------------------------------------------------
259 pub fn bitwise_and_to_lshift(a
: i32) -> i32 {
264 #[rustc_clean(except="hir_owner_nodes,optimized_mir,mir_built", cfg="cfail2")]
265 #[rustc_clean(cfg="cfail3")]
266 pub fn bitwise_and_to_lshift(a
: i32) -> i32 {
272 // Change operator from & to >> ------------------------------------------------
274 pub fn bitwise_and_to_rshift(a
: i32) -> i32 {
279 #[rustc_clean(except="hir_owner_nodes,optimized_mir,mir_built", cfg="cfail2")]
280 #[rustc_clean(cfg="cfail3")]
281 pub fn bitwise_and_to_rshift(a
: i32) -> i32 {
287 // Change operator from == to != -----------------------------------------------
289 pub fn eq_to_uneq(a
: i32) -> bool
{
294 #[rustc_clean(except="hir_owner_nodes,optimized_mir,mir_built", cfg="cfail2")]
295 #[rustc_clean(cfg="cfail3")]
296 pub fn eq_to_uneq(a
: i32) -> bool
{
302 // Change operator from == to < ------------------------------------------------
304 pub fn eq_to_lt(a
: i32) -> bool
{
309 #[rustc_clean(except="hir_owner_nodes,optimized_mir,mir_built", cfg="cfail2")]
310 #[rustc_clean(cfg="cfail3")]
311 pub fn eq_to_lt(a
: i32) -> bool
{
317 // Change operator from == to > ------------------------------------------------
319 pub fn eq_to_gt(a
: i32) -> bool
{
324 #[rustc_clean(except="hir_owner_nodes,optimized_mir,mir_built", cfg="cfail2")]
325 #[rustc_clean(cfg="cfail3")]
326 pub fn eq_to_gt(a
: i32) -> bool
{
332 // Change operator from == to <= -----------------------------------------------
334 pub fn eq_to_le(a
: i32) -> bool
{
339 #[rustc_clean(except="hir_owner_nodes,optimized_mir,mir_built", cfg="cfail2")]
340 #[rustc_clean(cfg="cfail3")]
341 pub fn eq_to_le(a
: i32) -> bool
{
347 // Change operator from == to >= -----------------------------------------------
349 pub fn eq_to_ge(a
: i32) -> bool
{
354 #[rustc_clean(except="hir_owner_nodes,optimized_mir,mir_built", cfg="cfail2")]
355 #[rustc_clean(cfg="cfail3")]
356 pub fn eq_to_ge(a
: i32) -> bool
{
362 // Change type in cast expression ----------------------------------------------
364 pub fn type_cast(a
: u8) -> u64 {
371 #[rustc_clean(except="hir_owner_nodes,optimized_mir,mir_built,typeck_tables_of", cfg="cfail2")]
372 #[rustc_clean(cfg="cfail3")]
373 pub fn type_cast(a
: u8) -> u64 {
381 // Change value in cast expression ---------------------------------------------
383 pub fn value_cast(a
: u32) -> i32 {
388 #[rustc_clean(except="hir_owner_nodes,optimized_mir,mir_built", cfg="cfail2")]
389 #[rustc_clean(cfg="cfail3")]
390 pub fn value_cast(a
: u32) -> i32 {
396 // Change place in assignment --------------------------------------------------
398 pub fn place() -> i32 {
406 #[rustc_clean(except="hir_owner_nodes,optimized_mir,mir_built", cfg="cfail2")]
407 #[rustc_clean(cfg="cfail3")]
408 pub fn place() -> i32 {
417 // Change r-value in assignment ------------------------------------------------
419 pub fn rvalue() -> i32 {
426 #[rustc_clean(except="hir_owner_nodes,optimized_mir,mir_built", cfg="cfail2")]
427 #[rustc_clean(cfg="cfail3")]
428 pub fn rvalue() -> i32 {
436 // Change index into slice -----------------------------------------------------
438 pub fn index_to_slice(s
: &[u8], i
: usize, j
: usize) -> u8 {
443 #[rustc_clean(except="hir_owner_nodes,optimized_mir,mir_built", cfg="cfail2")]
444 #[rustc_clean(cfg="cfail3")]
445 pub fn index_to_slice(s
: &[u8], i
: usize, j
: usize) -> u8 {