2016-11-05 20:31:57 -05:00
|
|
|
// This test case tests the incremental compilation hash (ICH) implementation
|
2016-11-07 11:42:20 -06:00
|
|
|
// for unary and binary expressions.
|
2016-11-05 20:31:57 -05:00
|
|
|
|
|
|
|
// The general pattern followed here is: Change one thing between rev1 and rev2
|
|
|
|
// and make sure that the hash has changed, then change nothing between rev2 and
|
|
|
|
// rev3 and make sure that the hash has not changed.
|
|
|
|
|
2019-07-02 16:30:28 -05:00
|
|
|
// build-pass (FIXME(62277): could be check-pass?)
|
2021-04-22 14:33:16 -05:00
|
|
|
// revisions: cfail1 cfail2 cfail3 cfail4 cfail5 cfail6
|
2022-05-27 20:17:39 -05:00
|
|
|
// compile-flags: -Z query-dep-graph -O
|
2021-04-22 14:33:16 -05:00
|
|
|
// [cfail1]compile-flags: -Zincremental-ignore-spans
|
|
|
|
// [cfail2]compile-flags: -Zincremental-ignore-spans
|
|
|
|
// [cfail3]compile-flags: -Zincremental-ignore-spans
|
2016-11-05 20:31:57 -05:00
|
|
|
|
|
|
|
#![allow(warnings)]
|
|
|
|
#![feature(rustc_attrs)]
|
|
|
|
#![crate_type="rlib"]
|
|
|
|
|
|
|
|
|
|
|
|
// Change constant operand of negation -----------------------------------------
|
2021-04-22 14:33:16 -05:00
|
|
|
#[cfg(any(cfail1,cfail4))]
|
2016-11-05 20:31:57 -05:00
|
|
|
pub fn const_negation() -> i32 {
|
|
|
|
-10
|
|
|
|
}
|
|
|
|
|
2021-04-22 14:33:16 -05:00
|
|
|
#[cfg(not(any(cfail1,cfail4)))]
|
2020-07-06 17:35:06 -05:00
|
|
|
#[rustc_clean(except="hir_owner_nodes,optimized_mir", cfg="cfail2")]
|
2017-11-12 18:12:29 -06:00
|
|
|
#[rustc_clean(cfg="cfail3")]
|
2021-04-22 14:33:16 -05:00
|
|
|
#[rustc_clean(except="hir_owner_nodes,optimized_mir", cfg="cfail5")]
|
|
|
|
#[rustc_clean(cfg="cfail6")]
|
2016-11-05 20:31:57 -05:00
|
|
|
pub fn const_negation() -> i32 {
|
2021-04-22 14:33:16 -05:00
|
|
|
-1
|
2016-11-05 20:31:57 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2016-11-07 11:42:20 -06:00
|
|
|
|
2016-11-05 20:31:57 -05:00
|
|
|
// Change constant operand of bitwise not --------------------------------------
|
2021-04-22 14:33:16 -05:00
|
|
|
#[cfg(any(cfail1,cfail4))]
|
2016-11-05 20:31:57 -05:00
|
|
|
pub fn const_bitwise_not() -> i32 {
|
|
|
|
!100
|
|
|
|
}
|
|
|
|
|
2021-04-22 14:33:16 -05:00
|
|
|
#[cfg(not(any(cfail1,cfail4)))]
|
2020-07-06 17:35:06 -05:00
|
|
|
#[rustc_clean(except="hir_owner_nodes,optimized_mir", cfg="cfail2")]
|
2017-11-12 18:12:29 -06:00
|
|
|
#[rustc_clean(cfg="cfail3")]
|
2021-04-22 14:33:16 -05:00
|
|
|
#[rustc_clean(except="hir_owner_nodes,optimized_mir", cfg="cfail5")]
|
|
|
|
#[rustc_clean(cfg="cfail6")]
|
2016-11-05 20:31:57 -05:00
|
|
|
pub fn const_bitwise_not() -> i32 {
|
2021-04-22 14:33:16 -05:00
|
|
|
!99
|
2016-11-05 20:31:57 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2016-11-07 11:42:20 -06:00
|
|
|
|
2016-11-05 20:31:57 -05:00
|
|
|
// Change variable operand of negation -----------------------------------------
|
2021-04-22 14:33:16 -05:00
|
|
|
#[cfg(any(cfail1,cfail4))]
|
2016-11-07 11:42:20 -06:00
|
|
|
pub fn var_negation(x: i32, y: i32) -> i32 {
|
2016-11-05 20:31:57 -05:00
|
|
|
-x
|
|
|
|
}
|
|
|
|
|
2021-04-22 14:33:16 -05:00
|
|
|
#[cfg(not(any(cfail1,cfail4)))]
|
2020-07-06 17:35:06 -05:00
|
|
|
#[rustc_clean(except="hir_owner_nodes,optimized_mir", cfg="cfail2")]
|
2017-11-12 18:12:29 -06:00
|
|
|
#[rustc_clean(cfg="cfail3")]
|
2021-04-22 14:33:16 -05:00
|
|
|
#[rustc_clean(except="hir_owner_nodes,optimized_mir", cfg="cfail5")]
|
|
|
|
#[rustc_clean(cfg="cfail6")]
|
2016-11-07 11:42:20 -06:00
|
|
|
pub fn var_negation(x: i32, y: i32) -> i32 {
|
2016-11-05 20:31:57 -05:00
|
|
|
-y
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2016-11-07 11:42:20 -06:00
|
|
|
|
2016-11-05 20:31:57 -05:00
|
|
|
// Change variable operand of bitwise not --------------------------------------
|
2021-04-22 14:33:16 -05:00
|
|
|
#[cfg(any(cfail1,cfail4))]
|
2016-11-07 11:42:20 -06:00
|
|
|
pub fn var_bitwise_not(x: i32, y: i32) -> i32 {
|
2016-11-05 20:31:57 -05:00
|
|
|
!x
|
|
|
|
}
|
|
|
|
|
2021-04-22 14:33:16 -05:00
|
|
|
#[cfg(not(any(cfail1,cfail4)))]
|
2020-07-06 17:35:06 -05:00
|
|
|
#[rustc_clean(except="hir_owner_nodes,optimized_mir", cfg="cfail2")]
|
2017-11-12 18:12:29 -06:00
|
|
|
#[rustc_clean(cfg="cfail3")]
|
2021-04-22 14:33:16 -05:00
|
|
|
#[rustc_clean(except="hir_owner_nodes,optimized_mir", cfg="cfail5")]
|
|
|
|
#[rustc_clean(cfg="cfail6")]
|
2016-11-07 11:42:20 -06:00
|
|
|
pub fn var_bitwise_not(x: i32, y: i32) -> i32 {
|
2016-11-05 20:31:57 -05:00
|
|
|
!y
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2016-11-07 11:42:20 -06:00
|
|
|
|
2016-11-05 20:31:57 -05:00
|
|
|
// Change variable operand of deref --------------------------------------------
|
2021-04-22 14:33:16 -05:00
|
|
|
#[cfg(any(cfail1,cfail4))]
|
2016-11-07 11:42:20 -06:00
|
|
|
pub fn var_deref(x: &i32, y: &i32) -> i32 {
|
2016-11-05 20:31:57 -05:00
|
|
|
*x
|
|
|
|
}
|
|
|
|
|
2021-04-22 14:33:16 -05:00
|
|
|
#[cfg(not(any(cfail1,cfail4)))]
|
2020-07-06 17:35:06 -05:00
|
|
|
#[rustc_clean(except="hir_owner_nodes,optimized_mir", cfg="cfail2")]
|
2017-11-12 18:12:29 -06:00
|
|
|
#[rustc_clean(cfg="cfail3")]
|
2021-04-22 14:33:16 -05:00
|
|
|
#[rustc_clean(except="hir_owner_nodes,optimized_mir", cfg="cfail5")]
|
|
|
|
#[rustc_clean(cfg="cfail6")]
|
2016-11-07 11:42:20 -06:00
|
|
|
pub fn var_deref(x: &i32, y: &i32) -> i32 {
|
2016-11-05 20:31:57 -05:00
|
|
|
*y
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2016-11-07 11:42:20 -06:00
|
|
|
|
2016-11-05 20:31:57 -05:00
|
|
|
// Change first constant operand of addition -----------------------------------
|
2021-04-22 14:33:16 -05:00
|
|
|
#[cfg(any(cfail1,cfail4))]
|
2016-11-05 20:31:57 -05:00
|
|
|
pub fn first_const_add() -> i32 {
|
|
|
|
1 + 3
|
|
|
|
}
|
|
|
|
|
2021-04-22 14:33:16 -05:00
|
|
|
#[cfg(not(any(cfail1,cfail4)))]
|
2020-07-06 17:35:06 -05:00
|
|
|
#[rustc_clean(except="hir_owner_nodes,optimized_mir", cfg="cfail2")]
|
2017-11-12 18:12:29 -06:00
|
|
|
#[rustc_clean(cfg="cfail3")]
|
2021-04-22 14:33:16 -05:00
|
|
|
#[rustc_clean(except="hir_owner_nodes,optimized_mir", cfg="cfail5")]
|
|
|
|
#[rustc_clean(cfg="cfail6")]
|
2016-11-05 20:31:57 -05:00
|
|
|
pub fn first_const_add() -> i32 {
|
|
|
|
2 + 3
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2016-11-07 11:42:20 -06:00
|
|
|
|
2016-11-05 20:31:57 -05:00
|
|
|
// Change second constant operand of addition -----------------------------------
|
2021-04-22 14:33:16 -05:00
|
|
|
#[cfg(any(cfail1,cfail4))]
|
2016-11-05 20:31:57 -05:00
|
|
|
pub fn second_const_add() -> i32 {
|
|
|
|
1 + 2
|
|
|
|
}
|
|
|
|
|
2021-04-22 14:33:16 -05:00
|
|
|
#[cfg(not(any(cfail1,cfail4)))]
|
2020-07-06 17:35:06 -05:00
|
|
|
#[rustc_clean(except="hir_owner_nodes,optimized_mir", cfg="cfail2")]
|
2017-11-12 18:12:29 -06:00
|
|
|
#[rustc_clean(cfg="cfail3")]
|
2021-04-22 14:33:16 -05:00
|
|
|
#[rustc_clean(except="hir_owner_nodes,optimized_mir", cfg="cfail5")]
|
|
|
|
#[rustc_clean(cfg="cfail6")]
|
2016-11-05 20:31:57 -05:00
|
|
|
pub fn second_const_add() -> i32 {
|
|
|
|
1 + 3
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2016-11-07 11:42:20 -06:00
|
|
|
|
2016-11-05 20:31:57 -05:00
|
|
|
// Change first variable operand of addition -----------------------------------
|
2021-04-22 14:33:16 -05:00
|
|
|
#[cfg(any(cfail1,cfail4))]
|
2016-11-07 11:42:20 -06:00
|
|
|
pub fn first_var_add(a: i32, b: i32) -> i32 {
|
2016-11-05 20:31:57 -05:00
|
|
|
a + 2
|
|
|
|
}
|
|
|
|
|
2021-04-22 14:33:16 -05:00
|
|
|
#[cfg(not(any(cfail1,cfail4)))]
|
2020-07-06 17:35:06 -05:00
|
|
|
#[rustc_clean(except="hir_owner_nodes,optimized_mir", cfg="cfail2")]
|
2017-11-12 18:12:29 -06:00
|
|
|
#[rustc_clean(cfg="cfail3")]
|
2021-04-22 14:33:16 -05:00
|
|
|
#[rustc_clean(except="hir_owner_nodes,optimized_mir", cfg="cfail5")]
|
|
|
|
#[rustc_clean(cfg="cfail6")]
|
2016-11-07 11:42:20 -06:00
|
|
|
pub fn first_var_add(a: i32, b: i32) -> i32 {
|
2016-11-07 12:59:48 -06:00
|
|
|
b + 2
|
2016-11-05 20:31:57 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2016-11-07 11:42:20 -06:00
|
|
|
|
2016-11-05 20:31:57 -05:00
|
|
|
// Change second variable operand of addition ----------------------------------
|
2021-04-22 14:33:16 -05:00
|
|
|
#[cfg(any(cfail1,cfail4))]
|
2016-11-07 11:42:20 -06:00
|
|
|
pub fn second_var_add(a: i32, b: i32) -> i32 {
|
2016-11-05 20:31:57 -05:00
|
|
|
1 + a
|
|
|
|
}
|
|
|
|
|
2021-04-22 14:33:16 -05:00
|
|
|
#[cfg(not(any(cfail1,cfail4)))]
|
2020-07-06 17:35:06 -05:00
|
|
|
#[rustc_clean(except="hir_owner_nodes,optimized_mir", cfg="cfail2")]
|
2017-11-12 18:12:29 -06:00
|
|
|
#[rustc_clean(cfg="cfail3")]
|
2021-04-22 14:33:16 -05:00
|
|
|
#[rustc_clean(except="hir_owner_nodes,optimized_mir", cfg="cfail5")]
|
|
|
|
#[rustc_clean(cfg="cfail6")]
|
2016-11-07 11:42:20 -06:00
|
|
|
pub fn second_var_add(a: i32, b: i32) -> i32 {
|
2016-11-05 20:31:57 -05:00
|
|
|
1 + b
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2016-11-07 11:42:20 -06:00
|
|
|
|
2016-11-05 20:31:57 -05:00
|
|
|
// Change operator from + to - -------------------------------------------------
|
2021-04-22 14:33:16 -05:00
|
|
|
#[cfg(any(cfail1,cfail4))]
|
2016-11-05 20:31:57 -05:00
|
|
|
pub fn plus_to_minus(a: i32) -> i32 {
|
|
|
|
1 + a
|
|
|
|
}
|
|
|
|
|
2021-04-22 14:33:16 -05:00
|
|
|
#[cfg(not(any(cfail1,cfail4)))]
|
2020-07-06 17:35:06 -05:00
|
|
|
#[rustc_clean(except="hir_owner_nodes,optimized_mir", cfg="cfail2")]
|
2017-11-12 18:12:29 -06:00
|
|
|
#[rustc_clean(cfg="cfail3")]
|
2021-04-22 14:33:16 -05:00
|
|
|
#[rustc_clean(except="hir_owner_nodes,optimized_mir", cfg="cfail5")]
|
|
|
|
#[rustc_clean(cfg="cfail6")]
|
2016-11-05 20:31:57 -05:00
|
|
|
pub fn plus_to_minus(a: i32) -> i32 {
|
|
|
|
1 - a
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2016-11-07 11:42:20 -06:00
|
|
|
|
2016-11-05 20:31:57 -05:00
|
|
|
// Change operator from + to * -------------------------------------------------
|
2021-04-22 14:33:16 -05:00
|
|
|
#[cfg(any(cfail1,cfail4))]
|
2016-11-05 20:31:57 -05:00
|
|
|
pub fn plus_to_mult(a: i32) -> i32 {
|
|
|
|
1 + a
|
|
|
|
}
|
|
|
|
|
2021-04-22 14:33:16 -05:00
|
|
|
#[cfg(not(any(cfail1,cfail4)))]
|
2020-07-06 17:35:06 -05:00
|
|
|
#[rustc_clean(except="hir_owner_nodes,optimized_mir", cfg="cfail2")]
|
2017-11-12 18:12:29 -06:00
|
|
|
#[rustc_clean(cfg="cfail3")]
|
2021-04-22 14:33:16 -05:00
|
|
|
#[rustc_clean(except="hir_owner_nodes,optimized_mir", cfg="cfail5")]
|
|
|
|
#[rustc_clean(cfg="cfail6")]
|
2016-11-05 20:31:57 -05:00
|
|
|
pub fn plus_to_mult(a: i32) -> i32 {
|
|
|
|
1 * a
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2016-11-07 11:42:20 -06:00
|
|
|
|
2016-11-05 20:31:57 -05:00
|
|
|
// Change operator from + to / -------------------------------------------------
|
2021-04-22 14:33:16 -05:00
|
|
|
#[cfg(any(cfail1,cfail4))]
|
2016-11-05 20:31:57 -05:00
|
|
|
pub fn plus_to_div(a: i32) -> i32 {
|
|
|
|
1 + a
|
|
|
|
}
|
|
|
|
|
2021-04-22 14:33:16 -05:00
|
|
|
#[cfg(not(any(cfail1,cfail4)))]
|
2020-07-06 17:35:06 -05:00
|
|
|
#[rustc_clean(except="hir_owner_nodes,optimized_mir", cfg="cfail2")]
|
2017-11-12 18:12:29 -06:00
|
|
|
#[rustc_clean(cfg="cfail3")]
|
2021-04-22 14:33:16 -05:00
|
|
|
#[rustc_clean(except="hir_owner_nodes,optimized_mir", cfg="cfail5")]
|
|
|
|
#[rustc_clean(cfg="cfail6")]
|
2016-11-05 20:31:57 -05:00
|
|
|
pub fn plus_to_div(a: i32) -> i32 {
|
|
|
|
1 / a
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2016-11-07 11:42:20 -06:00
|
|
|
|
2016-11-05 20:31:57 -05:00
|
|
|
// Change operator from + to % -------------------------------------------------
|
2021-04-22 14:33:16 -05:00
|
|
|
#[cfg(any(cfail1,cfail4))]
|
2016-11-05 20:31:57 -05:00
|
|
|
pub fn plus_to_mod(a: i32) -> i32 {
|
|
|
|
1 + a
|
|
|
|
}
|
|
|
|
|
2021-04-22 14:33:16 -05:00
|
|
|
#[cfg(not(any(cfail1,cfail4)))]
|
2020-07-06 17:35:06 -05:00
|
|
|
#[rustc_clean(except="hir_owner_nodes,optimized_mir", cfg="cfail2")]
|
2017-11-12 18:12:29 -06:00
|
|
|
#[rustc_clean(cfg="cfail3")]
|
2021-04-22 14:33:16 -05:00
|
|
|
#[rustc_clean(except="hir_owner_nodes,optimized_mir", cfg="cfail5")]
|
|
|
|
#[rustc_clean(cfg="cfail6")]
|
2016-11-05 20:31:57 -05:00
|
|
|
pub fn plus_to_mod(a: i32) -> i32 {
|
|
|
|
1 % a
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2016-11-07 11:42:20 -06:00
|
|
|
|
2016-11-05 20:31:57 -05:00
|
|
|
// Change operator from && to || -----------------------------------------------
|
2021-04-22 14:33:16 -05:00
|
|
|
#[cfg(any(cfail1,cfail4))]
|
2016-11-05 20:31:57 -05:00
|
|
|
pub fn and_to_or(a: bool, b: bool) -> bool {
|
|
|
|
a && b
|
|
|
|
}
|
|
|
|
|
2021-04-22 14:33:16 -05:00
|
|
|
#[cfg(not(any(cfail1,cfail4)))]
|
2020-07-06 17:35:06 -05:00
|
|
|
#[rustc_clean(except="hir_owner_nodes,optimized_mir", cfg="cfail2")]
|
2017-11-12 18:12:29 -06:00
|
|
|
#[rustc_clean(cfg="cfail3")]
|
2021-04-22 14:33:16 -05:00
|
|
|
#[rustc_clean(except="hir_owner_nodes,optimized_mir", cfg="cfail5")]
|
|
|
|
#[rustc_clean(cfg="cfail6")]
|
2016-11-05 20:31:57 -05:00
|
|
|
pub fn and_to_or(a: bool, b: bool) -> bool {
|
|
|
|
a || b
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Change operator from & to | -------------------------------------------------
|
2021-04-22 14:33:16 -05:00
|
|
|
#[cfg(any(cfail1,cfail4))]
|
2016-11-05 20:31:57 -05:00
|
|
|
pub fn bitwise_and_to_bitwise_or(a: i32) -> i32 {
|
|
|
|
1 & a
|
|
|
|
}
|
|
|
|
|
2021-04-22 14:33:16 -05:00
|
|
|
#[cfg(not(any(cfail1,cfail4)))]
|
2020-07-06 17:35:06 -05:00
|
|
|
#[rustc_clean(except="hir_owner_nodes,optimized_mir", cfg="cfail2")]
|
2017-11-12 18:12:29 -06:00
|
|
|
#[rustc_clean(cfg="cfail3")]
|
2021-04-22 14:33:16 -05:00
|
|
|
#[rustc_clean(except="hir_owner_nodes,optimized_mir", cfg="cfail5")]
|
|
|
|
#[rustc_clean(cfg="cfail6")]
|
2016-11-05 20:31:57 -05:00
|
|
|
pub fn bitwise_and_to_bitwise_or(a: i32) -> i32 {
|
|
|
|
1 | a
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Change operator from & to ^ -------------------------------------------------
|
2021-04-22 14:33:16 -05:00
|
|
|
#[cfg(any(cfail1,cfail4))]
|
2016-11-05 20:31:57 -05:00
|
|
|
pub fn bitwise_and_to_bitwise_xor(a: i32) -> i32 {
|
|
|
|
1 & a
|
|
|
|
}
|
|
|
|
|
2021-04-22 14:33:16 -05:00
|
|
|
#[cfg(not(any(cfail1,cfail4)))]
|
2020-07-06 17:35:06 -05:00
|
|
|
#[rustc_clean(except="hir_owner_nodes,optimized_mir", cfg="cfail2")]
|
2017-11-12 18:12:29 -06:00
|
|
|
#[rustc_clean(cfg="cfail3")]
|
2021-04-22 14:33:16 -05:00
|
|
|
#[rustc_clean(except="hir_owner_nodes,optimized_mir", cfg="cfail5")]
|
|
|
|
#[rustc_clean(cfg="cfail6")]
|
2016-11-05 20:31:57 -05:00
|
|
|
pub fn bitwise_and_to_bitwise_xor(a: i32) -> i32 {
|
|
|
|
1 ^ a
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Change operator from & to << ------------------------------------------------
|
2021-04-22 14:33:16 -05:00
|
|
|
#[cfg(any(cfail1,cfail4))]
|
2016-11-05 20:31:57 -05:00
|
|
|
pub fn bitwise_and_to_lshift(a: i32) -> i32 {
|
2021-04-22 14:33:16 -05:00
|
|
|
a & 1
|
2016-11-05 20:31:57 -05:00
|
|
|
}
|
|
|
|
|
2021-04-22 14:33:16 -05:00
|
|
|
#[cfg(not(any(cfail1,cfail4)))]
|
2020-07-06 17:35:06 -05:00
|
|
|
#[rustc_clean(except="hir_owner_nodes,optimized_mir", cfg="cfail2")]
|
2017-11-12 18:12:29 -06:00
|
|
|
#[rustc_clean(cfg="cfail3")]
|
2021-04-22 14:33:16 -05:00
|
|
|
#[rustc_clean(except="hir_owner_nodes,optimized_mir", cfg="cfail5")]
|
|
|
|
#[rustc_clean(cfg="cfail6")]
|
2016-11-05 20:31:57 -05:00
|
|
|
pub fn bitwise_and_to_lshift(a: i32) -> i32 {
|
|
|
|
a << 1
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Change operator from & to >> ------------------------------------------------
|
2021-04-22 14:33:16 -05:00
|
|
|
#[cfg(any(cfail1,cfail4))]
|
2016-11-05 20:31:57 -05:00
|
|
|
pub fn bitwise_and_to_rshift(a: i32) -> i32 {
|
2021-04-22 14:33:16 -05:00
|
|
|
a & 1
|
2016-11-05 20:31:57 -05:00
|
|
|
}
|
|
|
|
|
2021-04-22 14:33:16 -05:00
|
|
|
#[cfg(not(any(cfail1,cfail4)))]
|
2020-07-06 17:35:06 -05:00
|
|
|
#[rustc_clean(except="hir_owner_nodes,optimized_mir", cfg="cfail2")]
|
2017-11-12 18:12:29 -06:00
|
|
|
#[rustc_clean(cfg="cfail3")]
|
2021-04-22 14:33:16 -05:00
|
|
|
#[rustc_clean(except="hir_owner_nodes,optimized_mir", cfg="cfail5")]
|
|
|
|
#[rustc_clean(cfg="cfail6")]
|
2016-11-05 20:31:57 -05:00
|
|
|
pub fn bitwise_and_to_rshift(a: i32) -> i32 {
|
|
|
|
a >> 1
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Change operator from == to != -----------------------------------------------
|
2021-04-22 14:33:16 -05:00
|
|
|
#[cfg(any(cfail1,cfail4))]
|
2016-11-05 20:31:57 -05:00
|
|
|
pub fn eq_to_uneq(a: i32) -> bool {
|
|
|
|
a == 1
|
|
|
|
}
|
|
|
|
|
2021-04-22 14:33:16 -05:00
|
|
|
#[cfg(not(any(cfail1,cfail4)))]
|
2020-07-06 17:35:06 -05:00
|
|
|
#[rustc_clean(except="hir_owner_nodes,optimized_mir", cfg="cfail2")]
|
2017-11-12 18:12:29 -06:00
|
|
|
#[rustc_clean(cfg="cfail3")]
|
2021-04-22 14:33:16 -05:00
|
|
|
#[rustc_clean(except="hir_owner_nodes,optimized_mir", cfg="cfail5")]
|
|
|
|
#[rustc_clean(cfg="cfail6")]
|
2016-11-05 20:31:57 -05:00
|
|
|
pub fn eq_to_uneq(a: i32) -> bool {
|
|
|
|
a != 1
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Change operator from == to < ------------------------------------------------
|
2021-04-22 14:33:16 -05:00
|
|
|
#[cfg(any(cfail1,cfail4))]
|
2016-11-05 20:31:57 -05:00
|
|
|
pub fn eq_to_lt(a: i32) -> bool {
|
|
|
|
a == 1
|
|
|
|
}
|
|
|
|
|
2021-04-22 14:33:16 -05:00
|
|
|
#[cfg(not(any(cfail1,cfail4)))]
|
2020-07-06 17:35:06 -05:00
|
|
|
#[rustc_clean(except="hir_owner_nodes,optimized_mir", cfg="cfail2")]
|
2017-11-12 18:12:29 -06:00
|
|
|
#[rustc_clean(cfg="cfail3")]
|
2021-04-22 14:33:16 -05:00
|
|
|
#[rustc_clean(except="hir_owner_nodes,optimized_mir", cfg="cfail5")]
|
|
|
|
#[rustc_clean(cfg="cfail6")]
|
2016-11-05 20:31:57 -05:00
|
|
|
pub fn eq_to_lt(a: i32) -> bool {
|
2021-04-22 14:33:16 -05:00
|
|
|
a < 1
|
2016-11-05 20:31:57 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Change operator from == to > ------------------------------------------------
|
2021-04-22 14:33:16 -05:00
|
|
|
#[cfg(any(cfail1,cfail4))]
|
2016-11-05 20:31:57 -05:00
|
|
|
pub fn eq_to_gt(a: i32) -> bool {
|
|
|
|
a == 1
|
|
|
|
}
|
|
|
|
|
2021-04-22 14:33:16 -05:00
|
|
|
#[cfg(not(any(cfail1,cfail4)))]
|
2020-07-06 17:35:06 -05:00
|
|
|
#[rustc_clean(except="hir_owner_nodes,optimized_mir", cfg="cfail2")]
|
2017-11-12 18:12:29 -06:00
|
|
|
#[rustc_clean(cfg="cfail3")]
|
2021-04-22 14:33:16 -05:00
|
|
|
#[rustc_clean(except="hir_owner_nodes,optimized_mir", cfg="cfail5")]
|
|
|
|
#[rustc_clean(cfg="cfail6")]
|
2016-11-05 20:31:57 -05:00
|
|
|
pub fn eq_to_gt(a: i32) -> bool {
|
2021-04-22 14:33:16 -05:00
|
|
|
a > 1
|
2016-11-05 20:31:57 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Change operator from == to <= -----------------------------------------------
|
2021-04-22 14:33:16 -05:00
|
|
|
#[cfg(any(cfail1,cfail4))]
|
2016-11-05 20:31:57 -05:00
|
|
|
pub fn eq_to_le(a: i32) -> bool {
|
|
|
|
a == 1
|
|
|
|
}
|
|
|
|
|
2021-04-22 14:33:16 -05:00
|
|
|
#[cfg(not(any(cfail1,cfail4)))]
|
2020-07-06 17:35:06 -05:00
|
|
|
#[rustc_clean(except="hir_owner_nodes,optimized_mir", cfg="cfail2")]
|
2017-11-12 18:12:29 -06:00
|
|
|
#[rustc_clean(cfg="cfail3")]
|
2021-04-22 14:33:16 -05:00
|
|
|
#[rustc_clean(except="hir_owner_nodes,optimized_mir", cfg="cfail5")]
|
|
|
|
#[rustc_clean(cfg="cfail6")]
|
2016-11-05 20:31:57 -05:00
|
|
|
pub fn eq_to_le(a: i32) -> bool {
|
|
|
|
a <= 1
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Change operator from == to >= -----------------------------------------------
|
2021-04-22 14:33:16 -05:00
|
|
|
#[cfg(any(cfail1,cfail4))]
|
2016-11-05 20:31:57 -05:00
|
|
|
pub fn eq_to_ge(a: i32) -> bool {
|
|
|
|
a == 1
|
|
|
|
}
|
|
|
|
|
2021-04-22 14:33:16 -05:00
|
|
|
#[cfg(not(any(cfail1,cfail4)))]
|
2020-07-06 17:35:06 -05:00
|
|
|
#[rustc_clean(except="hir_owner_nodes,optimized_mir", cfg="cfail2")]
|
2017-11-12 18:12:29 -06:00
|
|
|
#[rustc_clean(cfg="cfail3")]
|
2021-04-22 14:33:16 -05:00
|
|
|
#[rustc_clean(except="hir_owner_nodes,optimized_mir", cfg="cfail5")]
|
|
|
|
#[rustc_clean(cfg="cfail6")]
|
2016-11-05 20:31:57 -05:00
|
|
|
pub fn eq_to_ge(a: i32) -> bool {
|
|
|
|
a >= 1
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Change type in cast expression ----------------------------------------------
|
2021-04-22 14:33:16 -05:00
|
|
|
#[cfg(any(cfail1,cfail4))]
|
2016-11-05 20:31:57 -05:00
|
|
|
pub fn type_cast(a: u8) -> u64 {
|
|
|
|
let b = a as i32;
|
|
|
|
let c = b as u64;
|
|
|
|
c
|
|
|
|
}
|
|
|
|
|
2021-04-22 14:33:16 -05:00
|
|
|
#[cfg(not(any(cfail1,cfail4)))]
|
2020-07-17 03:47:04 -05:00
|
|
|
#[rustc_clean(except="hir_owner_nodes,optimized_mir,typeck", cfg="cfail2")]
|
2017-11-12 18:12:29 -06:00
|
|
|
#[rustc_clean(cfg="cfail3")]
|
2021-04-22 14:33:16 -05:00
|
|
|
#[rustc_clean(except="hir_owner_nodes,optimized_mir,typeck", cfg="cfail5")]
|
|
|
|
#[rustc_clean(cfg="cfail6")]
|
2016-11-05 20:31:57 -05:00
|
|
|
pub fn type_cast(a: u8) -> u64 {
|
|
|
|
let b = a as u32;
|
|
|
|
let c = b as u64;
|
|
|
|
c
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Change value in cast expression ---------------------------------------------
|
2021-04-22 14:33:16 -05:00
|
|
|
#[cfg(any(cfail1,cfail4))]
|
2016-11-05 20:31:57 -05:00
|
|
|
pub fn value_cast(a: u32) -> i32 {
|
|
|
|
1 as i32
|
|
|
|
}
|
|
|
|
|
2021-04-22 14:33:16 -05:00
|
|
|
#[cfg(not(any(cfail1,cfail4)))]
|
2020-07-06 17:35:06 -05:00
|
|
|
#[rustc_clean(except="hir_owner_nodes,optimized_mir", cfg="cfail2")]
|
2017-11-12 18:12:29 -06:00
|
|
|
#[rustc_clean(cfg="cfail3")]
|
2021-04-22 14:33:16 -05:00
|
|
|
#[rustc_clean(except="hir_owner_nodes,optimized_mir", cfg="cfail5")]
|
|
|
|
#[rustc_clean(cfg="cfail6")]
|
2016-11-05 20:31:57 -05:00
|
|
|
pub fn value_cast(a: u32) -> i32 {
|
|
|
|
2 as i32
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
2018-01-28 17:59:34 -06:00
|
|
|
// Change place in assignment --------------------------------------------------
|
2021-04-22 14:33:16 -05:00
|
|
|
#[cfg(any(cfail1,cfail4))]
|
2018-01-28 17:59:34 -06:00
|
|
|
pub fn place() -> i32 {
|
2016-11-07 11:42:20 -06:00
|
|
|
let mut x = 10;
|
|
|
|
let mut y = 11;
|
|
|
|
x = 9;
|
2016-11-05 20:31:57 -05:00
|
|
|
x
|
|
|
|
}
|
|
|
|
|
2021-04-22 14:33:16 -05:00
|
|
|
#[cfg(not(any(cfail1,cfail4)))]
|
2020-07-06 17:35:06 -05:00
|
|
|
#[rustc_clean(except="hir_owner_nodes,optimized_mir", cfg="cfail2")]
|
2017-11-12 18:12:29 -06:00
|
|
|
#[rustc_clean(cfg="cfail3")]
|
2021-04-22 14:33:16 -05:00
|
|
|
#[rustc_clean(except="hir_owner_nodes,optimized_mir", cfg="cfail5")]
|
|
|
|
#[rustc_clean(cfg="cfail6")]
|
2018-01-28 17:59:34 -06:00
|
|
|
pub fn place() -> i32 {
|
2016-11-07 11:42:20 -06:00
|
|
|
let mut x = 10;
|
|
|
|
let mut y = 11;
|
2016-11-07 12:59:48 -06:00
|
|
|
y = 9;
|
|
|
|
x
|
2016-11-05 20:31:57 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Change r-value in assignment ------------------------------------------------
|
2021-04-22 14:33:16 -05:00
|
|
|
#[cfg(any(cfail1,cfail4))]
|
2016-11-05 20:31:57 -05:00
|
|
|
pub fn rvalue() -> i32 {
|
2016-11-07 11:42:20 -06:00
|
|
|
let mut x = 10;
|
|
|
|
x = 9;
|
2016-11-05 20:31:57 -05:00
|
|
|
x
|
|
|
|
}
|
|
|
|
|
2021-04-22 14:33:16 -05:00
|
|
|
#[cfg(not(any(cfail1,cfail4)))]
|
2020-07-06 17:35:06 -05:00
|
|
|
#[rustc_clean(except="hir_owner_nodes,optimized_mir", cfg="cfail2")]
|
2017-11-12 18:12:29 -06:00
|
|
|
#[rustc_clean(cfg="cfail3")]
|
2021-04-22 14:33:16 -05:00
|
|
|
#[rustc_clean(except="hir_owner_nodes,optimized_mir", cfg="cfail5")]
|
|
|
|
#[rustc_clean(cfg="cfail6")]
|
2016-11-05 20:31:57 -05:00
|
|
|
pub fn rvalue() -> i32 {
|
2016-11-07 11:42:20 -06:00
|
|
|
let mut x = 10;
|
|
|
|
x = 8;
|
2016-11-05 20:31:57 -05:00
|
|
|
x
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Change index into slice -----------------------------------------------------
|
2021-04-22 14:33:16 -05:00
|
|
|
#[cfg(any(cfail1,cfail4))]
|
2016-11-07 11:42:20 -06:00
|
|
|
pub fn index_to_slice(s: &[u8], i: usize, j: usize) -> u8 {
|
|
|
|
s[i]
|
2016-11-05 20:31:57 -05:00
|
|
|
}
|
|
|
|
|
2021-04-22 14:33:16 -05:00
|
|
|
#[cfg(not(any(cfail1,cfail4)))]
|
2020-07-06 17:35:06 -05:00
|
|
|
#[rustc_clean(except="hir_owner_nodes,optimized_mir", cfg="cfail2")]
|
2017-11-12 18:12:29 -06:00
|
|
|
#[rustc_clean(cfg="cfail3")]
|
2021-04-22 14:33:16 -05:00
|
|
|
#[rustc_clean(except="hir_owner_nodes,optimized_mir", cfg="cfail5")]
|
|
|
|
#[rustc_clean(cfg="cfail6")]
|
2016-11-07 11:42:20 -06:00
|
|
|
pub fn index_to_slice(s: &[u8], i: usize, j: usize) -> u8 {
|
|
|
|
s[j]
|
2016-11-05 20:31:57 -05:00
|
|
|
}
|