diff options
| author | Michael Woerister <michaelwoerister@posteo> | 2017-11-07 15:49:51 +0100 |
|---|---|---|
| committer | Michael Woerister <michaelwoerister@posteo> | 2017-11-07 15:49:51 +0100 |
| commit | a1364cd0db6a533dfe9c693827ef20fe6118af11 (patch) | |
| tree | 193998200be524f4b0304e4ebd057eec1ebe0ace | |
| parent | 3c6f620ea0b2e2be73b8d84961bc5f916f16675e (diff) | |
| download | rust-a1364cd0db6a533dfe9c693827ef20fe6118af11.tar.gz rust-a1364cd0db6a533dfe9c693827ef20fe6118af11.zip | |
incr.comp.: Acknowledge the fact that shift operations can panic at runtime.
| -rw-r--r-- | src/librustc/ich/hcx.rs | 4 | ||||
| -rw-r--r-- | src/test/incremental/hashes/panic_exprs.rs | 39 |
2 files changed, 39 insertions, 4 deletions
diff --git a/src/librustc/ich/hcx.rs b/src/librustc/ich/hcx.rs index d24344e4e21..f204d352842 100644 --- a/src/librustc/ich/hcx.rs +++ b/src/librustc/ich/hcx.rs @@ -227,6 +227,8 @@ impl<'gcx> StableHashingContext<'gcx> { match binop { hir::BiAdd | hir::BiSub | + hir::BiShl | + hir::BiShr | hir::BiMul => self.overflow_checks_enabled, hir::BiDiv | @@ -237,8 +239,6 @@ impl<'gcx> StableHashingContext<'gcx> { hir::BiBitXor | hir::BiBitAnd | hir::BiBitOr | - hir::BiShl | - hir::BiShr | hir::BiEq | hir::BiLt | hir::BiLe | diff --git a/src/test/incremental/hashes/panic_exprs.rs b/src/test/incremental/hashes/panic_exprs.rs index 5d4d434fd63..4a3e4bc49ce 100644 --- a/src/test/incremental/hashes/panic_exprs.rs +++ b/src/test/incremental/hashes/panic_exprs.rs @@ -152,13 +152,48 @@ pub fn mod_by_zero(val: i32) -> i32 { } +// shift left ------------------------------------------------------------------ +#[cfg(cfail1)] +pub fn shift_left(val: i32, shift: usize) -> i32 { + val << shift +} + +#[cfg(not(cfail1))] +#[rustc_clean(label="Hir", cfg="cfail2")] +#[rustc_clean(label="Hir", cfg="cfail3")] +#[rustc_dirty(label="HirBody", cfg="cfail2")] +#[rustc_clean(label="HirBody", cfg="cfail3")] +#[rustc_metadata_clean(cfg="cfail2")] +#[rustc_metadata_clean(cfg="cfail3")] +pub fn shift_left(val: i32, shift: usize) -> i32 { + val << shift +} + + +// shift right ------------------------------------------------------------------ +#[cfg(cfail1)] +pub fn shift_right(val: i32, shift: usize) -> i32 { + val >> shift +} + +#[cfg(not(cfail1))] +#[rustc_clean(label="Hir", cfg="cfail2")] +#[rustc_clean(label="Hir", cfg="cfail3")] +#[rustc_dirty(label="HirBody", cfg="cfail2")] +#[rustc_clean(label="HirBody", cfg="cfail3")] +#[rustc_metadata_clean(cfg="cfail2")] +#[rustc_metadata_clean(cfg="cfail3")] +pub fn shift_right(val: i32, shift: usize) -> i32 { + val >> shift +} + // THE FOLLOWING ITEMS SHOULD NOT BE INFLUENCED BY THEIR SOURCE LOCATION // bitwise --------------------------------------------------------------------- #[cfg(cfail1)] pub fn bitwise(val: i32) -> i32 { - !val & 0x101010101 | 0x45689 ^ 0x2372382 << 1 >> 1 + !val & 0x101010101 | 0x45689 ^ 0x2372382 } #[cfg(not(cfail1))] @@ -169,7 +204,7 @@ pub fn bitwise(val: i32) -> i32 { #[rustc_metadata_clean(cfg="cfail2")] #[rustc_metadata_clean(cfg="cfail3")] pub fn bitwise(val: i32) -> i32 { - !val & 0x101010101 | 0x45689 ^ 0x2372382 << 1 >> 1 + !val & 0x101010101 | 0x45689 ^ 0x2372382 } |
