diff --git a/src/librustc_lint/lib.rs b/src/librustc_lint/lib.rs index 2204e104803..0e7625da30a 100644 --- a/src/librustc_lint/lib.rs +++ b/src/librustc_lint/lib.rs @@ -305,6 +305,7 @@ fn register_builtins(store: &mut LintStore, no_interleave_lints: bool) { store.register_renamed("unstable_name_collision", "unstable_name_collisions"); store.register_renamed("unused_doc_comment", "unused_doc_comments"); store.register_renamed("async_idents", "keyword_idents"); + store.register_renamed("exceeding_bitshifts", "arithmetic_overflow"); store.register_removed("unknown_features", "replaced by an error"); store.register_removed("unsigned_negation", "replaced by negate_unsigned feature gate"); store.register_removed("negate_unsigned", "cast a signed value instead"); diff --git a/src/librustc_mir/transform/const_prop.rs b/src/librustc_mir/transform/const_prop.rs index eec4bbc720d..8ccfcecdbe3 100644 --- a/src/librustc_mir/transform/const_prop.rs +++ b/src/librustc_mir/transform/const_prop.rs @@ -531,7 +531,7 @@ impl<'mir, 'tcx> ConstPropagator<'mir, 'tcx> { // appropriate to use. assert_eq!(op, UnOp::Neg, "Neg is the only UnOp that can overflow"); self.report_assert_as_lint( - lint::builtin::OVERFLOW, + lint::builtin::ARITHMETIC_OVERFLOW, source_info, "this arithmetic operation will overflow", AssertKind::OverflowNeg, @@ -560,7 +560,7 @@ impl<'mir, 'tcx> ConstPropagator<'mir, 'tcx> { let r_bits = r.to_scalar().and_then(|r| r.to_bits(right_size)); if r_bits.map_or(false, |b| b >= left_size_bits as u128) { self.report_assert_as_lint( - lint::builtin::EXCEEDING_BITSHIFTS, + lint::builtin::ARITHMETIC_OVERFLOW, source_info, "this arithmetic operation will overflow", AssertKind::Overflow(op), @@ -575,7 +575,7 @@ impl<'mir, 'tcx> ConstPropagator<'mir, 'tcx> { Ok(overflow) })? { self.report_assert_as_lint( - lint::builtin::OVERFLOW, + lint::builtin::ARITHMETIC_OVERFLOW, source_info, "this arithmetic operation will overflow", AssertKind::Overflow(op), @@ -937,7 +937,7 @@ impl<'mir, 'tcx> MutVisitor<'tcx> for ConstPropagator<'mir, 'tcx> { _ => return, }; self.report_assert_as_lint( - lint::builtin::PANIC, + lint::builtin::UNCONDITIONAL_PANIC, source_info, "this operation will panic at runtime", msg, diff --git a/src/librustc_session/lint/builtin.rs b/src/librustc_session/lint/builtin.rs index 992f8ab2617..603ed4640a0 100644 --- a/src/librustc_session/lint/builtin.rs +++ b/src/librustc_session/lint/builtin.rs @@ -41,19 +41,13 @@ declare_lint! { } declare_lint! { - pub EXCEEDING_BITSHIFTS, - Deny, - "shift exceeds the type's number of bits" -} - -declare_lint! { - pub OVERFLOW, + pub ARITHMETIC_OVERFLOW, Deny, "arithmetic operation overflows" } declare_lint! { - pub PANIC, + pub UNCONDITIONAL_PANIC, Deny, "operation will cause a panic at runtime" } @@ -507,9 +501,8 @@ declare_lint_pass! { /// that are used by other parts of the compiler. HardwiredLints => [ ILLEGAL_FLOATING_POINT_LITERAL_PATTERN, - EXCEEDING_BITSHIFTS, - OVERFLOW, - PANIC, + ARITHMETIC_OVERFLOW, + UNCONDITIONAL_PANIC, UNUSED_IMPORTS, UNUSED_EXTERN_CRATES, UNUSED_QUALIFICATIONS, diff --git a/src/test/codegen/issue-56927.rs b/src/test/codegen/issue-56927.rs index 5ba17d3499b..d502673e2f8 100644 --- a/src/test/codegen/issue-56927.rs +++ b/src/test/codegen/issue-56927.rs @@ -23,7 +23,7 @@ pub fn test1(s: &mut S) { // CHECK-LABEL: @test2 // CHECK: store i32 4, i32* %{{.+}}, align 4 -#[allow(panic)] +#[allow(unconditional_panic)] #[no_mangle] pub fn test2(s: &mut S) { s.arr[usize::MAX / 4 + 1] = 4; diff --git a/src/test/incremental/warnings-reemitted.rs b/src/test/incremental/warnings-reemitted.rs index 657bc30c088..0eac2a1d57f 100644 --- a/src/test/incremental/warnings-reemitted.rs +++ b/src/test/incremental/warnings-reemitted.rs @@ -2,7 +2,7 @@ // compile-flags: -Coverflow-checks=on // build-pass (FIXME(62277): could be check-pass?) -#![warn(overflow)] +#![warn(arithmetic_overflow)] fn main() { let _ = 255u8 + 1; //~ WARNING operation will overflow diff --git a/src/test/run-fail/mir_indexing_oob_1.rs b/src/test/run-fail/mir_indexing_oob_1.rs index 6aaf46cfb1b..1cd53e309eb 100644 --- a/src/test/run-fail/mir_indexing_oob_1.rs +++ b/src/test/run-fail/mir_indexing_oob_1.rs @@ -2,7 +2,7 @@ const C: [u32; 5] = [0; 5]; -#[allow(panic, const_err)] +#[allow(unconditional_panic)] fn test() -> u32 { C[10] } diff --git a/src/test/run-fail/mir_indexing_oob_2.rs b/src/test/run-fail/mir_indexing_oob_2.rs index 1bf8459a068..64b260993c9 100644 --- a/src/test/run-fail/mir_indexing_oob_2.rs +++ b/src/test/run-fail/mir_indexing_oob_2.rs @@ -2,7 +2,7 @@ const C: &'static [u8; 5] = b"hello"; -#[allow(panic, const_err)] +#[allow(unconditional_panic)] fn test() -> u8 { C[10] } diff --git a/src/test/run-fail/mir_indexing_oob_3.rs b/src/test/run-fail/mir_indexing_oob_3.rs index c13ca721ea8..3688088439b 100644 --- a/src/test/run-fail/mir_indexing_oob_3.rs +++ b/src/test/run-fail/mir_indexing_oob_3.rs @@ -2,7 +2,7 @@ const C: &'static [u8; 5] = b"hello"; -#[allow(panic, const_err)] +#[allow(unconditional_panic)] fn mir() -> u8 { C[10] } diff --git a/src/test/run-fail/overflowing-add.rs b/src/test/run-fail/overflowing-add.rs index 69d7779e13e..5ca91314d95 100644 --- a/src/test/run-fail/overflowing-add.rs +++ b/src/test/run-fail/overflowing-add.rs @@ -1,7 +1,7 @@ // error-pattern:thread 'main' panicked at 'attempt to add with overflow' // compile-flags: -C debug-assertions -#![allow(overflow)] +#![allow(arithmetic_overflow)] fn main() { let _x = 200u8 + 200u8 + 200u8; diff --git a/src/test/run-fail/overflowing-lsh-1.rs b/src/test/run-fail/overflowing-lsh-1.rs index 37fbf01e487..977cfea0fe0 100644 --- a/src/test/run-fail/overflowing-lsh-1.rs +++ b/src/test/run-fail/overflowing-lsh-1.rs @@ -1,7 +1,7 @@ // error-pattern:thread 'main' panicked at 'attempt to shift left with overflow' // compile-flags: -C debug-assertions -#![warn(exceeding_bitshifts)] +#![warn(arithmetic_overflow)] #![warn(const_err)] fn main() { diff --git a/src/test/run-fail/overflowing-lsh-2.rs b/src/test/run-fail/overflowing-lsh-2.rs index 7b0b37dfed0..3517dacde3a 100644 --- a/src/test/run-fail/overflowing-lsh-2.rs +++ b/src/test/run-fail/overflowing-lsh-2.rs @@ -1,7 +1,7 @@ // error-pattern:thread 'main' panicked at 'attempt to shift left with overflow' // compile-flags: -C debug-assertions -#![warn(exceeding_bitshifts)] +#![warn(arithmetic_overflow)] #![warn(const_err)] fn main() { diff --git a/src/test/run-fail/overflowing-lsh-3.rs b/src/test/run-fail/overflowing-lsh-3.rs index 1768a8e6d31..4a575c3fa7f 100644 --- a/src/test/run-fail/overflowing-lsh-3.rs +++ b/src/test/run-fail/overflowing-lsh-3.rs @@ -1,7 +1,7 @@ // error-pattern:thread 'main' panicked at 'attempt to shift left with overflow' // compile-flags: -C debug-assertions -#![warn(exceeding_bitshifts)] +#![warn(arithmetic_overflow)] #![warn(const_err)] fn main() { diff --git a/src/test/run-fail/overflowing-lsh-4.rs b/src/test/run-fail/overflowing-lsh-4.rs index ec304b4144e..0d3912ce13f 100644 --- a/src/test/run-fail/overflowing-lsh-4.rs +++ b/src/test/run-fail/overflowing-lsh-4.rs @@ -4,7 +4,7 @@ // This function is checking that our automatic truncation does not // sidestep the overflow checking. -#![warn(exceeding_bitshifts)] +#![warn(arithmetic_overflow)] #![warn(const_err)] fn main() { diff --git a/src/test/run-fail/overflowing-mul.rs b/src/test/run-fail/overflowing-mul.rs index ef191c01586..2dfc9bb5ae4 100644 --- a/src/test/run-fail/overflowing-mul.rs +++ b/src/test/run-fail/overflowing-mul.rs @@ -1,7 +1,7 @@ // error-pattern:thread 'main' panicked at 'attempt to multiply with overflow' // compile-flags: -C debug-assertions -#![allow(overflow)] +#![allow(arithmetic_overflow)] fn main() { let x = 200u8 * 4; diff --git a/src/test/run-fail/overflowing-neg.rs b/src/test/run-fail/overflowing-neg.rs index 443cddf53fb..f512aa35bed 100644 --- a/src/test/run-fail/overflowing-neg.rs +++ b/src/test/run-fail/overflowing-neg.rs @@ -1,7 +1,7 @@ // error-pattern:thread 'main' panicked at 'attempt to negate with overflow' // compile-flags: -C debug-assertions -#![allow(overflow)] +#![allow(arithmetic_overflow)] fn main() { let _x = -std::i8::MIN; diff --git a/src/test/run-fail/overflowing-rsh-1.rs b/src/test/run-fail/overflowing-rsh-1.rs index 14514540c06..4592b2b6260 100644 --- a/src/test/run-fail/overflowing-rsh-1.rs +++ b/src/test/run-fail/overflowing-rsh-1.rs @@ -1,7 +1,7 @@ // error-pattern:thread 'main' panicked at 'attempt to shift right with overflow' // compile-flags: -C debug-assertions -#![warn(exceeding_bitshifts)] +#![warn(arithmetic_overflow)] #![warn(const_err)] fn main() { diff --git a/src/test/run-fail/overflowing-rsh-2.rs b/src/test/run-fail/overflowing-rsh-2.rs index 83dcbd13d2a..066267b770d 100644 --- a/src/test/run-fail/overflowing-rsh-2.rs +++ b/src/test/run-fail/overflowing-rsh-2.rs @@ -1,7 +1,7 @@ // error-pattern:thread 'main' panicked at 'attempt to shift right with overflow' // compile-flags: -C debug-assertions -#![warn(exceeding_bitshifts)] +#![warn(arithmetic_overflow)] #![warn(const_err)] fn main() { diff --git a/src/test/run-fail/overflowing-rsh-3.rs b/src/test/run-fail/overflowing-rsh-3.rs index 3521c050659..67e78482866 100644 --- a/src/test/run-fail/overflowing-rsh-3.rs +++ b/src/test/run-fail/overflowing-rsh-3.rs @@ -1,7 +1,7 @@ // error-pattern:thread 'main' panicked at 'attempt to shift right with overflow' // compile-flags: -C debug-assertions -#![warn(exceeding_bitshifts)] +#![warn(arithmetic_overflow)] #![warn(const_err)] fn main() { diff --git a/src/test/run-fail/overflowing-rsh-4.rs b/src/test/run-fail/overflowing-rsh-4.rs index ed1191849e5..1877d5c9685 100644 --- a/src/test/run-fail/overflowing-rsh-4.rs +++ b/src/test/run-fail/overflowing-rsh-4.rs @@ -4,7 +4,7 @@ // This function is checking that our (type-based) automatic // truncation does not sidestep the overflow checking. -#![warn(exceeding_bitshifts)] +#![warn(arithmetic_overflow)] #![warn(const_err)] fn main() { diff --git a/src/test/run-fail/overflowing-rsh-5.rs b/src/test/run-fail/overflowing-rsh-5.rs index 58dfc5710ae..20ef324a82a 100644 --- a/src/test/run-fail/overflowing-rsh-5.rs +++ b/src/test/run-fail/overflowing-rsh-5.rs @@ -1,7 +1,7 @@ // error-pattern:thread 'main' panicked at 'attempt to shift right with overflow' // compile-flags: -C debug-assertions -#![warn(exceeding_bitshifts)] +#![warn(arithmetic_overflow)] #![warn(const_err)] fn main() { diff --git a/src/test/run-fail/overflowing-rsh-6.rs b/src/test/run-fail/overflowing-rsh-6.rs index c2fec5e4860..589a98bab04 100644 --- a/src/test/run-fail/overflowing-rsh-6.rs +++ b/src/test/run-fail/overflowing-rsh-6.rs @@ -1,7 +1,7 @@ // error-pattern:thread 'main' panicked at 'attempt to shift right with overflow' // compile-flags: -C debug-assertions -#![warn(exceeding_bitshifts)] +#![warn(arithmetic_overflow)] #![warn(const_err)] #![feature(const_indexing)] diff --git a/src/test/run-fail/overflowing-sub.rs b/src/test/run-fail/overflowing-sub.rs index 4f4a3eed8cc..fb096c31957 100644 --- a/src/test/run-fail/overflowing-sub.rs +++ b/src/test/run-fail/overflowing-sub.rs @@ -1,7 +1,7 @@ // error-pattern:thread 'main' panicked at 'attempt to subtract with overflow' // compile-flags: -C debug-assertions -#![allow(overflow)] +#![allow(arithmetic_overflow)] fn main() { let _x = 42u8 - (42u8 + 1); diff --git a/src/test/run-fail/promoted_div_by_zero.rs b/src/test/run-fail/promoted_div_by_zero.rs index 0ad081f0314..dc6719ce025 100644 --- a/src/test/run-fail/promoted_div_by_zero.rs +++ b/src/test/run-fail/promoted_div_by_zero.rs @@ -1,4 +1,4 @@ -#![allow(panic, const_err)] +#![allow(unconditional_panic, const_err)] // error-pattern: attempt to divide by zero diff --git a/src/test/run-fail/promoted_overflow.rs b/src/test/run-fail/promoted_overflow.rs index a90f832ddd0..3c42da4b1d8 100644 --- a/src/test/run-fail/promoted_overflow.rs +++ b/src/test/run-fail/promoted_overflow.rs @@ -1,4 +1,4 @@ -#![allow(overflow)] +#![allow(arithmetic_overflow)] // error-pattern: overflow // compile-flags: -C overflow-checks=yes diff --git a/src/test/ui/consts/array-literal-index-oob.rs b/src/test/ui/consts/array-literal-index-oob.rs index 978f2333101..492afa9372c 100644 --- a/src/test/ui/consts/array-literal-index-oob.rs +++ b/src/test/ui/consts/array-literal-index-oob.rs @@ -1,7 +1,7 @@ // build-pass // ignore-pass (emit codegen-time warnings and verify that they are indeed warnings and not errors) -#![warn(const_err, panic)] +#![warn(const_err, unconditional_panic)] fn main() { &{ [1, 2, 3][4] }; diff --git a/src/test/ui/consts/array-literal-index-oob.stderr b/src/test/ui/consts/array-literal-index-oob.stderr index 605cd73db1f..6e0e7fedb7b 100644 --- a/src/test/ui/consts/array-literal-index-oob.stderr +++ b/src/test/ui/consts/array-literal-index-oob.stderr @@ -7,8 +7,8 @@ LL | &{ [1, 2, 3][4] }; note: the lint level is defined here --> $DIR/array-literal-index-oob.rs:4:20 | -LL | #![warn(const_err, panic)] - | ^^^^^ +LL | #![warn(const_err, unconditional_panic)] + | ^^^^^^^^^^^^^^^^^^^ warning: reaching this expression at runtime will panic or abort --> $DIR/array-literal-index-oob.rs:7:8 @@ -21,7 +21,7 @@ LL | &{ [1, 2, 3][4] }; note: the lint level is defined here --> $DIR/array-literal-index-oob.rs:4:9 | -LL | #![warn(const_err, panic)] +LL | #![warn(const_err, unconditional_panic)] | ^^^^^^^^^ warning: erroneous constant used diff --git a/src/test/ui/consts/const-err.rs b/src/test/ui/consts/const-err.rs index b204f705a96..d1c5f4f3f32 100644 --- a/src/test/ui/consts/const-err.rs +++ b/src/test/ui/consts/const-err.rs @@ -1,7 +1,7 @@ // build-fail // compile-flags: -Zforce-overflow-checks=on -#![allow(exceeding_bitshifts)] +#![allow(arithmetic_overflow)] #![warn(const_err)] fn black_box(_: T) { diff --git a/src/test/ui/consts/const-err2.default.stderr b/src/test/ui/consts/const-err2.default.stderr index 226874c29da..5aeeec4bd14 100644 --- a/src/test/ui/consts/const-err2.default.stderr +++ b/src/test/ui/consts/const-err2.default.stderr @@ -4,7 +4,7 @@ error: this arithmetic operation will overflow LL | let a = -std::i8::MIN; | ^^^^^^^^^^^^^ attempt to negate with overflow | - = note: `#[deny(overflow)]` on by default + = note: `#[deny(arithmetic_overflow)]` on by default error: this arithmetic operation will overflow --> $DIR/const-err2.rs:21:18 @@ -42,7 +42,7 @@ error: this operation will panic at runtime LL | let _e = [5u8][1]; | ^^^^^^^^ index out of bounds: the len is 1 but the index is 1 | - = note: `#[deny(panic)]` on by default + = note: `#[deny(unconditional_panic)]` on by default error: aborting due to 7 previous errors diff --git a/src/test/ui/consts/const-err2.noopt.stderr b/src/test/ui/consts/const-err2.noopt.stderr index 226874c29da..5aeeec4bd14 100644 --- a/src/test/ui/consts/const-err2.noopt.stderr +++ b/src/test/ui/consts/const-err2.noopt.stderr @@ -4,7 +4,7 @@ error: this arithmetic operation will overflow LL | let a = -std::i8::MIN; | ^^^^^^^^^^^^^ attempt to negate with overflow | - = note: `#[deny(overflow)]` on by default + = note: `#[deny(arithmetic_overflow)]` on by default error: this arithmetic operation will overflow --> $DIR/const-err2.rs:21:18 @@ -42,7 +42,7 @@ error: this operation will panic at runtime LL | let _e = [5u8][1]; | ^^^^^^^^ index out of bounds: the len is 1 but the index is 1 | - = note: `#[deny(panic)]` on by default + = note: `#[deny(unconditional_panic)]` on by default error: aborting due to 7 previous errors diff --git a/src/test/ui/consts/const-err2.opt.stderr b/src/test/ui/consts/const-err2.opt.stderr index 226874c29da..5aeeec4bd14 100644 --- a/src/test/ui/consts/const-err2.opt.stderr +++ b/src/test/ui/consts/const-err2.opt.stderr @@ -4,7 +4,7 @@ error: this arithmetic operation will overflow LL | let a = -std::i8::MIN; | ^^^^^^^^^^^^^ attempt to negate with overflow | - = note: `#[deny(overflow)]` on by default + = note: `#[deny(arithmetic_overflow)]` on by default error: this arithmetic operation will overflow --> $DIR/const-err2.rs:21:18 @@ -42,7 +42,7 @@ error: this operation will panic at runtime LL | let _e = [5u8][1]; | ^^^^^^^^ index out of bounds: the len is 1 but the index is 1 | - = note: `#[deny(panic)]` on by default + = note: `#[deny(unconditional_panic)]` on by default error: aborting due to 7 previous errors diff --git a/src/test/ui/consts/const-err2.opt_with_overflow_checks.stderr b/src/test/ui/consts/const-err2.opt_with_overflow_checks.stderr index 226874c29da..5aeeec4bd14 100644 --- a/src/test/ui/consts/const-err2.opt_with_overflow_checks.stderr +++ b/src/test/ui/consts/const-err2.opt_with_overflow_checks.stderr @@ -4,7 +4,7 @@ error: this arithmetic operation will overflow LL | let a = -std::i8::MIN; | ^^^^^^^^^^^^^ attempt to negate with overflow | - = note: `#[deny(overflow)]` on by default + = note: `#[deny(arithmetic_overflow)]` on by default error: this arithmetic operation will overflow --> $DIR/const-err2.rs:21:18 @@ -42,7 +42,7 @@ error: this operation will panic at runtime LL | let _e = [5u8][1]; | ^^^^^^^^ index out of bounds: the len is 1 but the index is 1 | - = note: `#[deny(panic)]` on by default + = note: `#[deny(unconditional_panic)]` on by default error: aborting due to 7 previous errors diff --git a/src/test/ui/consts/const-eval/index_out_of_bounds_propagated.stderr b/src/test/ui/consts/const-eval/index_out_of_bounds_propagated.stderr index 5da802d30f5..4188efd021d 100644 --- a/src/test/ui/consts/const-eval/index_out_of_bounds_propagated.stderr +++ b/src/test/ui/consts/const-eval/index_out_of_bounds_propagated.stderr @@ -4,7 +4,7 @@ error: this operation will panic at runtime LL | array[1]; | ^^^^^^^^ index out of bounds: the len is 1 but the index is 1 | - = note: `#[deny(panic)]` on by default + = note: `#[deny(unconditional_panic)]` on by default error: aborting due to previous error diff --git a/src/test/ui/consts/const-eval/promoted_errors.default.stderr b/src/test/ui/consts/const-eval/promoted_errors.default.stderr index 8f21ce53715..034dea06568 100644 --- a/src/test/ui/consts/const-eval/promoted_errors.default.stderr +++ b/src/test/ui/consts/const-eval/promoted_errors.default.stderr @@ -7,8 +7,8 @@ LL | let _x = 0u32 - 1; note: the lint level is defined here --> $DIR/promoted_errors.rs:9:20 | -LL | #![warn(const_err, overflow, panic)] - | ^^^^^^^^ +LL | #![warn(const_err, arithmetic_overflow, unconditional_panic)] + | ^^^^^^^^^^^^^^^^^^^ warning: this operation will panic at runtime --> $DIR/promoted_errors.rs:16:20 @@ -17,10 +17,10 @@ LL | println!("{}", 1 / (1 - 1)); | ^^^^^^^^^^^ attempt to divide by zero | note: the lint level is defined here - --> $DIR/promoted_errors.rs:9:30 + --> $DIR/promoted_errors.rs:9:41 | -LL | #![warn(const_err, overflow, panic)] - | ^^^^^ +LL | #![warn(const_err, arithmetic_overflow, unconditional_panic)] + | ^^^^^^^^^^^^^^^^^^^ warning: reaching this expression at runtime will panic or abort --> $DIR/promoted_errors.rs:16:20 @@ -31,7 +31,7 @@ LL | println!("{}", 1 / (1 - 1)); note: the lint level is defined here --> $DIR/promoted_errors.rs:9:9 | -LL | #![warn(const_err, overflow, panic)] +LL | #![warn(const_err, arithmetic_overflow, unconditional_panic)] | ^^^^^^^^^ warning: erroneous constant used diff --git a/src/test/ui/consts/const-eval/promoted_errors.noopt.stderr b/src/test/ui/consts/const-eval/promoted_errors.noopt.stderr index 1ed60c1f96e..94c1593240b 100644 --- a/src/test/ui/consts/const-eval/promoted_errors.noopt.stderr +++ b/src/test/ui/consts/const-eval/promoted_errors.noopt.stderr @@ -7,8 +7,8 @@ LL | println!("{}", 0u32 - 1); note: the lint level is defined here --> $DIR/promoted_errors.rs:9:20 | -LL | #![warn(const_err, overflow, panic)] - | ^^^^^^^^ +LL | #![warn(const_err, arithmetic_overflow, unconditional_panic)] + | ^^^^^^^^^^^^^^^^^^^ warning: this arithmetic operation will overflow --> $DIR/promoted_errors.rs:14:14 @@ -23,10 +23,10 @@ LL | println!("{}", 1 / (1 - 1)); | ^^^^^^^^^^^ attempt to divide by zero | note: the lint level is defined here - --> $DIR/promoted_errors.rs:9:30 + --> $DIR/promoted_errors.rs:9:41 | -LL | #![warn(const_err, overflow, panic)] - | ^^^^^ +LL | #![warn(const_err, arithmetic_overflow, unconditional_panic)] + | ^^^^^^^^^^^^^^^^^^^ warning: reaching this expression at runtime will panic or abort --> $DIR/promoted_errors.rs:16:20 @@ -37,7 +37,7 @@ LL | println!("{}", 1 / (1 - 1)); note: the lint level is defined here --> $DIR/promoted_errors.rs:9:9 | -LL | #![warn(const_err, overflow, panic)] +LL | #![warn(const_err, arithmetic_overflow, unconditional_panic)] | ^^^^^^^^^ warning: erroneous constant used diff --git a/src/test/ui/consts/const-eval/promoted_errors.opt.stderr b/src/test/ui/consts/const-eval/promoted_errors.opt.stderr index 8f21ce53715..034dea06568 100644 --- a/src/test/ui/consts/const-eval/promoted_errors.opt.stderr +++ b/src/test/ui/consts/const-eval/promoted_errors.opt.stderr @@ -7,8 +7,8 @@ LL | let _x = 0u32 - 1; note: the lint level is defined here --> $DIR/promoted_errors.rs:9:20 | -LL | #![warn(const_err, overflow, panic)] - | ^^^^^^^^ +LL | #![warn(const_err, arithmetic_overflow, unconditional_panic)] + | ^^^^^^^^^^^^^^^^^^^ warning: this operation will panic at runtime --> $DIR/promoted_errors.rs:16:20 @@ -17,10 +17,10 @@ LL | println!("{}", 1 / (1 - 1)); | ^^^^^^^^^^^ attempt to divide by zero | note: the lint level is defined here - --> $DIR/promoted_errors.rs:9:30 + --> $DIR/promoted_errors.rs:9:41 | -LL | #![warn(const_err, overflow, panic)] - | ^^^^^ +LL | #![warn(const_err, arithmetic_overflow, unconditional_panic)] + | ^^^^^^^^^^^^^^^^^^^ warning: reaching this expression at runtime will panic or abort --> $DIR/promoted_errors.rs:16:20 @@ -31,7 +31,7 @@ LL | println!("{}", 1 / (1 - 1)); note: the lint level is defined here --> $DIR/promoted_errors.rs:9:9 | -LL | #![warn(const_err, overflow, panic)] +LL | #![warn(const_err, arithmetic_overflow, unconditional_panic)] | ^^^^^^^^^ warning: erroneous constant used diff --git a/src/test/ui/consts/const-eval/promoted_errors.opt_with_overflow_checks.stderr b/src/test/ui/consts/const-eval/promoted_errors.opt_with_overflow_checks.stderr index 1ed60c1f96e..94c1593240b 100644 --- a/src/test/ui/consts/const-eval/promoted_errors.opt_with_overflow_checks.stderr +++ b/src/test/ui/consts/const-eval/promoted_errors.opt_with_overflow_checks.stderr @@ -7,8 +7,8 @@ LL | println!("{}", 0u32 - 1); note: the lint level is defined here --> $DIR/promoted_errors.rs:9:20 | -LL | #![warn(const_err, overflow, panic)] - | ^^^^^^^^ +LL | #![warn(const_err, arithmetic_overflow, unconditional_panic)] + | ^^^^^^^^^^^^^^^^^^^ warning: this arithmetic operation will overflow --> $DIR/promoted_errors.rs:14:14 @@ -23,10 +23,10 @@ LL | println!("{}", 1 / (1 - 1)); | ^^^^^^^^^^^ attempt to divide by zero | note: the lint level is defined here - --> $DIR/promoted_errors.rs:9:30 + --> $DIR/promoted_errors.rs:9:41 | -LL | #![warn(const_err, overflow, panic)] - | ^^^^^ +LL | #![warn(const_err, arithmetic_overflow, unconditional_panic)] + | ^^^^^^^^^^^^^^^^^^^ warning: reaching this expression at runtime will panic or abort --> $DIR/promoted_errors.rs:16:20 @@ -37,7 +37,7 @@ LL | println!("{}", 1 / (1 - 1)); note: the lint level is defined here --> $DIR/promoted_errors.rs:9:9 | -LL | #![warn(const_err, overflow, panic)] +LL | #![warn(const_err, arithmetic_overflow, unconditional_panic)] | ^^^^^^^^^ warning: erroneous constant used diff --git a/src/test/ui/consts/const-eval/promoted_errors.rs b/src/test/ui/consts/const-eval/promoted_errors.rs index 3133e9b380b..b734f70f9f0 100644 --- a/src/test/ui/consts/const-eval/promoted_errors.rs +++ b/src/test/ui/consts/const-eval/promoted_errors.rs @@ -6,23 +6,23 @@ // build-pass // ignore-pass (emit codegen-time warnings and verify that they are indeed warnings and not errors) -#![warn(const_err, overflow, panic)] +#![warn(const_err, arithmetic_overflow, unconditional_panic)] fn main() { println!("{}", 0u32 - 1); - //[opt_with_overflow_checks,noopt]~^ WARN [overflow] + //[opt_with_overflow_checks,noopt]~^ WARN [arithmetic_overflow] let _x = 0u32 - 1; - //~^ WARN [overflow] + //~^ WARN [arithmetic_overflow] println!("{}", 1 / (1 - 1)); - //~^ WARN [panic] + //~^ WARN [unconditional_panic] //~| WARN panic or abort [const_err] //~| WARN erroneous constant used [const_err] let _x = 1 / (1 - 1); - //~^ WARN [panic] + //~^ WARN [unconditional_panic] println!("{}", 1 / (false as u32)); - //~^ WARN [panic] + //~^ WARN [unconditional_panic] //~| WARN panic or abort [const_err] //~| WARN erroneous constant used [const_err] let _x = 1 / (false as u32); - //~^ WARN [panic] + //~^ WARN [unconditional_panic] } diff --git a/src/test/ui/consts/const-prop-ice.stderr b/src/test/ui/consts/const-prop-ice.stderr index 855b9e6b64b..7bb4acb235a 100644 --- a/src/test/ui/consts/const-prop-ice.stderr +++ b/src/test/ui/consts/const-prop-ice.stderr @@ -4,7 +4,7 @@ error: this operation will panic at runtime LL | [0; 3][3u64 as usize]; | ^^^^^^^^^^^^^^^^^^^^^ index out of bounds: the len is 3 but the index is 3 | - = note: `#[deny(panic)]` on by default + = note: `#[deny(unconditional_panic)]` on by default error: aborting due to previous error diff --git a/src/test/ui/consts/const-prop-ice2.stderr b/src/test/ui/consts/const-prop-ice2.stderr index 07faa39edc2..73405eca340 100644 --- a/src/test/ui/consts/const-prop-ice2.stderr +++ b/src/test/ui/consts/const-prop-ice2.stderr @@ -4,7 +4,7 @@ error: this operation will panic at runtime LL | println!("{}", xs[Enum::One as usize]); | ^^^^^^^^^^^^^^^^^^^^^^ index out of bounds: the len is 1 but the index is 1 | - = note: `#[deny(panic)]` on by default + = note: `#[deny(unconditional_panic)]` on by default error: aborting due to previous error diff --git a/src/test/ui/consts/issue-69020.default.stderr b/src/test/ui/consts/issue-69020.default.stderr index 1b1987f4dc3..c48a106ef46 100644 --- a/src/test/ui/consts/issue-69020.default.stderr +++ b/src/test/ui/consts/issue-69020.default.stderr @@ -4,7 +4,7 @@ error: this arithmetic operation will overflow LL | const NEG: i32 = -i32::MIN + T::NEG; | ^^^^^^^^^ attempt to negate with overflow | - = note: `#[deny(overflow)]` on by default + = note: `#[deny(arithmetic_overflow)]` on by default error: this arithmetic operation will overflow --> $DIR/issue-69020.rs:23:22 @@ -18,7 +18,7 @@ error: this operation will panic at runtime LL | const DIV: i32 = (1/0) + T::DIV; | ^^^^^ attempt to divide by zero | - = note: `#[deny(panic)]` on by default + = note: `#[deny(unconditional_panic)]` on by default error: this operation will panic at runtime --> $DIR/issue-69020.rs:27:22 diff --git a/src/test/ui/consts/issue-69020.noopt.stderr b/src/test/ui/consts/issue-69020.noopt.stderr index 1b1987f4dc3..c48a106ef46 100644 --- a/src/test/ui/consts/issue-69020.noopt.stderr +++ b/src/test/ui/consts/issue-69020.noopt.stderr @@ -4,7 +4,7 @@ error: this arithmetic operation will overflow LL | const NEG: i32 = -i32::MIN + T::NEG; | ^^^^^^^^^ attempt to negate with overflow | - = note: `#[deny(overflow)]` on by default + = note: `#[deny(arithmetic_overflow)]` on by default error: this arithmetic operation will overflow --> $DIR/issue-69020.rs:23:22 @@ -18,7 +18,7 @@ error: this operation will panic at runtime LL | const DIV: i32 = (1/0) + T::DIV; | ^^^^^ attempt to divide by zero | - = note: `#[deny(panic)]` on by default + = note: `#[deny(unconditional_panic)]` on by default error: this operation will panic at runtime --> $DIR/issue-69020.rs:27:22 diff --git a/src/test/ui/consts/issue-69020.opt.stderr b/src/test/ui/consts/issue-69020.opt.stderr index 1b1987f4dc3..c48a106ef46 100644 --- a/src/test/ui/consts/issue-69020.opt.stderr +++ b/src/test/ui/consts/issue-69020.opt.stderr @@ -4,7 +4,7 @@ error: this arithmetic operation will overflow LL | const NEG: i32 = -i32::MIN + T::NEG; | ^^^^^^^^^ attempt to negate with overflow | - = note: `#[deny(overflow)]` on by default + = note: `#[deny(arithmetic_overflow)]` on by default error: this arithmetic operation will overflow --> $DIR/issue-69020.rs:23:22 @@ -18,7 +18,7 @@ error: this operation will panic at runtime LL | const DIV: i32 = (1/0) + T::DIV; | ^^^^^ attempt to divide by zero | - = note: `#[deny(panic)]` on by default + = note: `#[deny(unconditional_panic)]` on by default error: this operation will panic at runtime --> $DIR/issue-69020.rs:27:22 diff --git a/src/test/ui/consts/issue-69020.opt_with_overflow_checks.stderr b/src/test/ui/consts/issue-69020.opt_with_overflow_checks.stderr index 1b1987f4dc3..c48a106ef46 100644 --- a/src/test/ui/consts/issue-69020.opt_with_overflow_checks.stderr +++ b/src/test/ui/consts/issue-69020.opt_with_overflow_checks.stderr @@ -4,7 +4,7 @@ error: this arithmetic operation will overflow LL | const NEG: i32 = -i32::MIN + T::NEG; | ^^^^^^^^^ attempt to negate with overflow | - = note: `#[deny(overflow)]` on by default + = note: `#[deny(arithmetic_overflow)]` on by default error: this arithmetic operation will overflow --> $DIR/issue-69020.rs:23:22 @@ -18,7 +18,7 @@ error: this operation will panic at runtime LL | const DIV: i32 = (1/0) + T::DIV; | ^^^^^ attempt to divide by zero | - = note: `#[deny(panic)]` on by default + = note: `#[deny(unconditional_panic)]` on by default error: this operation will panic at runtime --> $DIR/issue-69020.rs:27:22 diff --git a/src/test/ui/huge-array-simple-64.rs b/src/test/ui/huge-array-simple-64.rs index d4c93301283..02c961fc5fa 100644 --- a/src/test/ui/huge-array-simple-64.rs +++ b/src/test/ui/huge-array-simple-64.rs @@ -4,7 +4,7 @@ // FIXME https://github.com/rust-lang/rust/issues/59774 // normalize-stderr-test "thread.*panicked.*Metadata module not compiled.*\n" -> "" // normalize-stderr-test "note:.*RUST_BACKTRACE=1.*\n" -> "" -#![allow(exceeding_bitshifts)] +#![allow(arithmetic_overflow)] fn main() { let _fat: [u8; (1<<61)+(1<<31)] = //~ ERROR too big for the current architecture diff --git a/src/test/ui/issues/issue-54348.stderr b/src/test/ui/issues/issue-54348.stderr index f2156a35f2a..6b67125e36c 100644 --- a/src/test/ui/issues/issue-54348.stderr +++ b/src/test/ui/issues/issue-54348.stderr @@ -4,7 +4,7 @@ error: this operation will panic at runtime LL | [1][1.5 as usize]; | ^^^^^^^^^^^^^^^^^ index out of bounds: the len is 1 but the index is 1 | - = note: `#[deny(panic)]` on by default + = note: `#[deny(unconditional_panic)]` on by default error: this operation will panic at runtime --> $DIR/issue-54348.rs:6:5 diff --git a/src/test/ui/issues/issue-8460-const.default.stderr b/src/test/ui/issues/issue-8460-const.default.stderr index 33d846e3e91..3556ec08247 100644 --- a/src/test/ui/issues/issue-8460-const.default.stderr +++ b/src/test/ui/issues/issue-8460-const.default.stderr @@ -4,7 +4,7 @@ error: this arithmetic operation will overflow LL | assert!(thread::spawn(move|| { isize::MIN / -1; }).join().is_err()); | ^^^^^^^^^^^^^^^ attempt to divide with overflow | - = note: `#[deny(overflow)]` on by default + = note: `#[deny(arithmetic_overflow)]` on by default error: this arithmetic operation will overflow --> $DIR/issue-8460-const.rs:16:36 @@ -42,7 +42,7 @@ error: this operation will panic at runtime LL | assert!(thread::spawn(move|| { 1isize / 0; }).join().is_err()); | ^^^^^^^^^^ attempt to divide by zero | - = note: `#[deny(panic)]` on by default + = note: `#[deny(unconditional_panic)]` on by default error: this operation will panic at runtime --> $DIR/issue-8460-const.rs:28:36 diff --git a/src/test/ui/issues/issue-8460-const.noopt.stderr b/src/test/ui/issues/issue-8460-const.noopt.stderr index 33d846e3e91..3556ec08247 100644 --- a/src/test/ui/issues/issue-8460-const.noopt.stderr +++ b/src/test/ui/issues/issue-8460-const.noopt.stderr @@ -4,7 +4,7 @@ error: this arithmetic operation will overflow LL | assert!(thread::spawn(move|| { isize::MIN / -1; }).join().is_err()); | ^^^^^^^^^^^^^^^ attempt to divide with overflow | - = note: `#[deny(overflow)]` on by default + = note: `#[deny(arithmetic_overflow)]` on by default error: this arithmetic operation will overflow --> $DIR/issue-8460-const.rs:16:36 @@ -42,7 +42,7 @@ error: this operation will panic at runtime LL | assert!(thread::spawn(move|| { 1isize / 0; }).join().is_err()); | ^^^^^^^^^^ attempt to divide by zero | - = note: `#[deny(panic)]` on by default + = note: `#[deny(unconditional_panic)]` on by default error: this operation will panic at runtime --> $DIR/issue-8460-const.rs:28:36 diff --git a/src/test/ui/issues/issue-8460-const.opt.stderr b/src/test/ui/issues/issue-8460-const.opt.stderr index 33d846e3e91..3556ec08247 100644 --- a/src/test/ui/issues/issue-8460-const.opt.stderr +++ b/src/test/ui/issues/issue-8460-const.opt.stderr @@ -4,7 +4,7 @@ error: this arithmetic operation will overflow LL | assert!(thread::spawn(move|| { isize::MIN / -1; }).join().is_err()); | ^^^^^^^^^^^^^^^ attempt to divide with overflow | - = note: `#[deny(overflow)]` on by default + = note: `#[deny(arithmetic_overflow)]` on by default error: this arithmetic operation will overflow --> $DIR/issue-8460-const.rs:16:36 @@ -42,7 +42,7 @@ error: this operation will panic at runtime LL | assert!(thread::spawn(move|| { 1isize / 0; }).join().is_err()); | ^^^^^^^^^^ attempt to divide by zero | - = note: `#[deny(panic)]` on by default + = note: `#[deny(unconditional_panic)]` on by default error: this operation will panic at runtime --> $DIR/issue-8460-const.rs:28:36 diff --git a/src/test/ui/issues/issue-8460-const.opt_with_overflow_checks.stderr b/src/test/ui/issues/issue-8460-const.opt_with_overflow_checks.stderr index 33d846e3e91..3556ec08247 100644 --- a/src/test/ui/issues/issue-8460-const.opt_with_overflow_checks.stderr +++ b/src/test/ui/issues/issue-8460-const.opt_with_overflow_checks.stderr @@ -4,7 +4,7 @@ error: this arithmetic operation will overflow LL | assert!(thread::spawn(move|| { isize::MIN / -1; }).join().is_err()); | ^^^^^^^^^^^^^^^ attempt to divide with overflow | - = note: `#[deny(overflow)]` on by default + = note: `#[deny(arithmetic_overflow)]` on by default error: this arithmetic operation will overflow --> $DIR/issue-8460-const.rs:16:36 @@ -42,7 +42,7 @@ error: this operation will panic at runtime LL | assert!(thread::spawn(move|| { 1isize / 0; }).join().is_err()); | ^^^^^^^^^^ attempt to divide by zero | - = note: `#[deny(panic)]` on by default + = note: `#[deny(unconditional_panic)]` on by default error: this operation will panic at runtime --> $DIR/issue-8460-const.rs:28:36 diff --git a/src/test/ui/lint/lint-exceeding-bitshifts.default.stderr b/src/test/ui/lint/lint-exceeding-bitshifts.default.stderr index 5e32466c4e0..ce9b02b6d82 100644 --- a/src/test/ui/lint/lint-exceeding-bitshifts.default.stderr +++ b/src/test/ui/lint/lint-exceeding-bitshifts.default.stderr @@ -7,7 +7,7 @@ LL | let _ = x << 42; note: the lint level is defined here --> $DIR/lint-exceeding-bitshifts.rs:9:9 | -LL | #![deny(exceeding_bitshifts, const_err)] +LL | #![deny(arithmetic_overflow, const_err)] | ^^^^^^^^^^^^^^^^^^^ error: this arithmetic operation will overflow diff --git a/src/test/ui/lint/lint-exceeding-bitshifts.noopt.stderr b/src/test/ui/lint/lint-exceeding-bitshifts.noopt.stderr index 5e32466c4e0..ce9b02b6d82 100644 --- a/src/test/ui/lint/lint-exceeding-bitshifts.noopt.stderr +++ b/src/test/ui/lint/lint-exceeding-bitshifts.noopt.stderr @@ -7,7 +7,7 @@ LL | let _ = x << 42; note: the lint level is defined here --> $DIR/lint-exceeding-bitshifts.rs:9:9 | -LL | #![deny(exceeding_bitshifts, const_err)] +LL | #![deny(arithmetic_overflow, const_err)] | ^^^^^^^^^^^^^^^^^^^ error: this arithmetic operation will overflow diff --git a/src/test/ui/lint/lint-exceeding-bitshifts.opt.stderr b/src/test/ui/lint/lint-exceeding-bitshifts.opt.stderr index 5e32466c4e0..ce9b02b6d82 100644 --- a/src/test/ui/lint/lint-exceeding-bitshifts.opt.stderr +++ b/src/test/ui/lint/lint-exceeding-bitshifts.opt.stderr @@ -7,7 +7,7 @@ LL | let _ = x << 42; note: the lint level is defined here --> $DIR/lint-exceeding-bitshifts.rs:9:9 | -LL | #![deny(exceeding_bitshifts, const_err)] +LL | #![deny(arithmetic_overflow, const_err)] | ^^^^^^^^^^^^^^^^^^^ error: this arithmetic operation will overflow diff --git a/src/test/ui/lint/lint-exceeding-bitshifts.opt_with_overflow_checks.stderr b/src/test/ui/lint/lint-exceeding-bitshifts.opt_with_overflow_checks.stderr index 5e32466c4e0..ce9b02b6d82 100644 --- a/src/test/ui/lint/lint-exceeding-bitshifts.opt_with_overflow_checks.stderr +++ b/src/test/ui/lint/lint-exceeding-bitshifts.opt_with_overflow_checks.stderr @@ -7,7 +7,7 @@ LL | let _ = x << 42; note: the lint level is defined here --> $DIR/lint-exceeding-bitshifts.rs:9:9 | -LL | #![deny(exceeding_bitshifts, const_err)] +LL | #![deny(arithmetic_overflow, const_err)] | ^^^^^^^^^^^^^^^^^^^ error: this arithmetic operation will overflow diff --git a/src/test/ui/lint/lint-exceeding-bitshifts.rs b/src/test/ui/lint/lint-exceeding-bitshifts.rs index 3c6d70e7a6f..04996e41bb3 100644 --- a/src/test/ui/lint/lint-exceeding-bitshifts.rs +++ b/src/test/ui/lint/lint-exceeding-bitshifts.rs @@ -6,7 +6,7 @@ // build-fail #![crate_type="lib"] -#![deny(exceeding_bitshifts, const_err)] +#![deny(arithmetic_overflow, const_err)] #![allow(unused_variables)] #![allow(dead_code)]