better lint names
This commit is contained in:
parent
97cc3a229b
commit
5e19350a4c
@ -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");
|
||||
|
@ -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,
|
||||
|
@ -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,
|
||||
|
@ -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;
|
||||
|
@ -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
|
||||
|
@ -2,7 +2,7 @@
|
||||
|
||||
const C: [u32; 5] = [0; 5];
|
||||
|
||||
#[allow(panic, const_err)]
|
||||
#[allow(unconditional_panic)]
|
||||
fn test() -> u32 {
|
||||
C[10]
|
||||
}
|
||||
|
@ -2,7 +2,7 @@
|
||||
|
||||
const C: &'static [u8; 5] = b"hello";
|
||||
|
||||
#[allow(panic, const_err)]
|
||||
#[allow(unconditional_panic)]
|
||||
fn test() -> u8 {
|
||||
C[10]
|
||||
}
|
||||
|
@ -2,7 +2,7 @@
|
||||
|
||||
const C: &'static [u8; 5] = b"hello";
|
||||
|
||||
#[allow(panic, const_err)]
|
||||
#[allow(unconditional_panic)]
|
||||
fn mir() -> u8 {
|
||||
C[10]
|
||||
}
|
||||
|
@ -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;
|
||||
|
@ -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() {
|
||||
|
@ -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() {
|
||||
|
@ -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() {
|
||||
|
@ -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() {
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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() {
|
||||
|
@ -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() {
|
||||
|
@ -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() {
|
||||
|
@ -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() {
|
||||
|
@ -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() {
|
||||
|
@ -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)]
|
||||
|
||||
|
@ -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);
|
||||
|
@ -1,4 +1,4 @@
|
||||
#![allow(panic, const_err)]
|
||||
#![allow(unconditional_panic, const_err)]
|
||||
|
||||
// error-pattern: attempt to divide by zero
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
#![allow(overflow)]
|
||||
#![allow(arithmetic_overflow)]
|
||||
|
||||
// error-pattern: overflow
|
||||
// compile-flags: -C overflow-checks=yes
|
||||
|
@ -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] };
|
||||
|
@ -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
|
||||
|
@ -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>(_: T) {
|
||||
|
@ -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
|
||||
|
||||
|
@ -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
|
||||
|
||||
|
@ -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
|
||||
|
||||
|
@ -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
|
||||
|
||||
|
@ -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
|
||||
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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]
|
||||
}
|
||||
|
@ -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
|
||||
|
||||
|
@ -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
|
||||
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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)]
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user