Skip to content

Commit 5b1a186

Browse files
committed
Enable ConstPropLint for promoteds
This fixes the issue wherein the lint didn't fire for promoteds in the case of SHL/SHR operators in non-optimized builds and all arithmetic operators in optimized builds
1 parent c77f7f3 commit 5b1a186

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

tests/pass/overflow_checks_off.rs

+6-1
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,17 @@
11
//@compile-flags: -C overflow-checks=off
22

33
// Check that we correctly implement the intended behavior of these operators
4-
// when they are not being overflow-checked.
4+
// when they are not being overflow-checked at runtime.
55

66
// FIXME: if we call the functions in `std::ops`, we still get the panics.
77
// Miri does not implement the codegen-time hack that backs `#[rustc_inherit_overflow_checks]`.
88
// use std::ops::*;
99

10+
11+
// Disable _compile-time_ overflow linting
12+
// so that we can test runtime overflow checks
13+
#![allow(arithmetic_overflow)]
14+
1015
fn main() {
1116
assert_eq!(-{ -0x80i8 }, -0x80);
1217

0 commit comments

Comments
 (0)