1 // This test case tests the incremental compilation hash (ICH) implementation
2 // for exprs that can panic at runtime (e.g., because of bounds checking). For
3 // these expressions an error message containing their source location is
4 // generated, so their hash must always depend on their location in the source
5 // code, not just when debuginfo is enabled.
7 // The general pattern followed here is: Change one thing between rev1 and rev2
8 // and make sure that the hash has changed, then change nothing between rev2 and
9 // rev3 and make sure that the hash has not changed.
11 // build-pass (FIXME(62277): could be check-pass?)
12 // revisions: cfail1 cfail2 cfail3
13 // compile-flags: -Z query-dep-graph -C debug-assertions
16 #![feature(rustc_attrs)]
20 // Indexing expression
21 #[rustc_clean(cfg="cfail2", except="hir_owner_nodes,optimized_mir")]
22 #[rustc_clean(cfg="cfail3")]
23 pub fn indexing(slice: &[u8]) -> u8 {
35 // Arithmetic overflow plus
36 #[rustc_clean(cfg="cfail2", except="hir_owner_nodes,optimized_mir")]
37 #[rustc_clean(cfg="cfail3")]
38 pub fn arithmetic_overflow_plus(val: i32) -> i32 {
50 // Arithmetic overflow minus
51 #[rustc_clean(cfg="cfail2", except="hir_owner_nodes,optimized_mir")]
52 #[rustc_clean(cfg="cfail3")]
53 pub fn arithmetic_overflow_minus(val: i32) -> i32 {
65 // Arithmetic overflow mult
66 #[rustc_clean(cfg="cfail2", except="hir_owner_nodes,optimized_mir")]
67 #[rustc_clean(cfg="cfail3")]
68 pub fn arithmetic_overflow_mult(val: i32) -> i32 {
80 // Arithmetic overflow negation
81 #[rustc_clean(cfg="cfail2", except="hir_owner_nodes,optimized_mir")]
82 #[rustc_clean(cfg="cfail3")]
83 pub fn arithmetic_overflow_negation(val: i32) -> i32 {
96 #[rustc_clean(cfg="cfail2", except="hir_owner_nodes,optimized_mir")]
97 #[rustc_clean(cfg="cfail3")]
98 pub fn division_by_zero(val: i32) -> i32 {
110 #[rustc_clean(cfg="cfail2", except="hir_owner_nodes,optimized_mir")]
111 #[rustc_clean(cfg="cfail3")]
112 pub fn mod_by_zero(val: i32) -> i32 {
125 #[rustc_clean(cfg="cfail2", except="hir_owner_nodes,optimized_mir")]
126 #[rustc_clean(cfg="cfail3")]
127 pub fn shift_left(val: i32, shift: usize) -> i32 {
140 #[rustc_clean(cfg="cfail2", except="hir_owner_nodes,optimized_mir")]
141 #[rustc_clean(cfg="cfail3")]
142 pub fn shift_right(val: i32, shift: usize) -> i32 {