Skip to content

Commit 5e19350

Browse files
committed
better lint names
1 parent 97cc3a2 commit 5e19350

File tree

54 files changed

+100
-106
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

54 files changed

+100
-106
lines changed

src/librustc_lint/lib.rs

+1
Original file line numberDiff line numberDiff line change
@@ -305,6 +305,7 @@ fn register_builtins(store: &mut LintStore, no_interleave_lints: bool) {
305305
store.register_renamed("unstable_name_collision", "unstable_name_collisions");
306306
store.register_renamed("unused_doc_comment", "unused_doc_comments");
307307
store.register_renamed("async_idents", "keyword_idents");
308+
store.register_renamed("exceeding_bitshifts", "arithmetic_overflow");
308309
store.register_removed("unknown_features", "replaced by an error");
309310
store.register_removed("unsigned_negation", "replaced by negate_unsigned feature gate");
310311
store.register_removed("negate_unsigned", "cast a signed value instead");

src/librustc_mir/transform/const_prop.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -531,7 +531,7 @@ impl<'mir, 'tcx> ConstPropagator<'mir, 'tcx> {
531531
// appropriate to use.
532532
assert_eq!(op, UnOp::Neg, "Neg is the only UnOp that can overflow");
533533
self.report_assert_as_lint(
534-
lint::builtin::OVERFLOW,
534+
lint::builtin::ARITHMETIC_OVERFLOW,
535535
source_info,
536536
"this arithmetic operation will overflow",
537537
AssertKind::OverflowNeg,
@@ -560,7 +560,7 @@ impl<'mir, 'tcx> ConstPropagator<'mir, 'tcx> {
560560
let r_bits = r.to_scalar().and_then(|r| r.to_bits(right_size));
561561
if r_bits.map_or(false, |b| b >= left_size_bits as u128) {
562562
self.report_assert_as_lint(
563-
lint::builtin::EXCEEDING_BITSHIFTS,
563+
lint::builtin::ARITHMETIC_OVERFLOW,
564564
source_info,
565565
"this arithmetic operation will overflow",
566566
AssertKind::Overflow(op),
@@ -575,7 +575,7 @@ impl<'mir, 'tcx> ConstPropagator<'mir, 'tcx> {
575575
Ok(overflow)
576576
})? {
577577
self.report_assert_as_lint(
578-
lint::builtin::OVERFLOW,
578+
lint::builtin::ARITHMETIC_OVERFLOW,
579579
source_info,
580580
"this arithmetic operation will overflow",
581581
AssertKind::Overflow(op),
@@ -937,7 +937,7 @@ impl<'mir, 'tcx> MutVisitor<'tcx> for ConstPropagator<'mir, 'tcx> {
937937
_ => return,
938938
};
939939
self.report_assert_as_lint(
940-
lint::builtin::PANIC,
940+
lint::builtin::UNCONDITIONAL_PANIC,
941941
source_info,
942942
"this operation will panic at runtime",
943943
msg,

src/librustc_session/lint/builtin.rs

+4-11
Original file line numberDiff line numberDiff line change
@@ -41,19 +41,13 @@ declare_lint! {
4141
}
4242

4343
declare_lint! {
44-
pub EXCEEDING_BITSHIFTS,
45-
Deny,
46-
"shift exceeds the type's number of bits"
47-
}
48-
49-
declare_lint! {
50-
pub OVERFLOW,
44+
pub ARITHMETIC_OVERFLOW,
5145
Deny,
5246
"arithmetic operation overflows"
5347
}
5448

5549
declare_lint! {
56-
pub PANIC,
50+
pub UNCONDITIONAL_PANIC,
5751
Deny,
5852
"operation will cause a panic at runtime"
5953
}
@@ -507,9 +501,8 @@ declare_lint_pass! {
507501
/// that are used by other parts of the compiler.
508502
HardwiredLints => [
509503
ILLEGAL_FLOATING_POINT_LITERAL_PATTERN,
510-
EXCEEDING_BITSHIFTS,
511-
OVERFLOW,
512-
PANIC,
504+
ARITHMETIC_OVERFLOW,
505+
UNCONDITIONAL_PANIC,
513506
UNUSED_IMPORTS,
514507
UNUSED_EXTERN_CRATES,
515508
UNUSED_QUALIFICATIONS,

src/test/codegen/issue-56927.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ pub fn test1(s: &mut S) {
2323

2424
// CHECK-LABEL: @test2
2525
// CHECK: store i32 4, i32* %{{.+}}, align 4
26-
#[allow(panic)]
26+
#[allow(unconditional_panic)]
2727
#[no_mangle]
2828
pub fn test2(s: &mut S) {
2929
s.arr[usize::MAX / 4 + 1] = 4;

src/test/incremental/warnings-reemitted.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// compile-flags: -Coverflow-checks=on
33
// build-pass (FIXME(62277): could be check-pass?)
44

5-
#![warn(overflow)]
5+
#![warn(arithmetic_overflow)]
66

77
fn main() {
88
let _ = 255u8 + 1; //~ WARNING operation will overflow

src/test/run-fail/mir_indexing_oob_1.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
const C: [u32; 5] = [0; 5];
44

5-
#[allow(panic, const_err)]
5+
#[allow(unconditional_panic)]
66
fn test() -> u32 {
77
C[10]
88
}

src/test/run-fail/mir_indexing_oob_2.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
const C: &'static [u8; 5] = b"hello";
44

5-
#[allow(panic, const_err)]
5+
#[allow(unconditional_panic)]
66
fn test() -> u8 {
77
C[10]
88
}

src/test/run-fail/mir_indexing_oob_3.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
const C: &'static [u8; 5] = b"hello";
44

5-
#[allow(panic, const_err)]
5+
#[allow(unconditional_panic)]
66
fn mir() -> u8 {
77
C[10]
88
}

src/test/run-fail/overflowing-add.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// error-pattern:thread 'main' panicked at 'attempt to add with overflow'
22
// compile-flags: -C debug-assertions
33

4-
#![allow(overflow)]
4+
#![allow(arithmetic_overflow)]
55

66
fn main() {
77
let _x = 200u8 + 200u8 + 200u8;

src/test/run-fail/overflowing-lsh-1.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// error-pattern:thread 'main' panicked at 'attempt to shift left with overflow'
22
// compile-flags: -C debug-assertions
33

4-
#![warn(exceeding_bitshifts)]
4+
#![warn(arithmetic_overflow)]
55
#![warn(const_err)]
66

77
fn main() {

src/test/run-fail/overflowing-lsh-2.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// error-pattern:thread 'main' panicked at 'attempt to shift left with overflow'
22
// compile-flags: -C debug-assertions
33

4-
#![warn(exceeding_bitshifts)]
4+
#![warn(arithmetic_overflow)]
55
#![warn(const_err)]
66

77
fn main() {

src/test/run-fail/overflowing-lsh-3.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// error-pattern:thread 'main' panicked at 'attempt to shift left with overflow'
22
// compile-flags: -C debug-assertions
33

4-
#![warn(exceeding_bitshifts)]
4+
#![warn(arithmetic_overflow)]
55
#![warn(const_err)]
66

77
fn main() {

src/test/run-fail/overflowing-lsh-4.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
// This function is checking that our automatic truncation does not
55
// sidestep the overflow checking.
66

7-
#![warn(exceeding_bitshifts)]
7+
#![warn(arithmetic_overflow)]
88
#![warn(const_err)]
99

1010
fn main() {

src/test/run-fail/overflowing-mul.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// error-pattern:thread 'main' panicked at 'attempt to multiply with overflow'
22
// compile-flags: -C debug-assertions
33

4-
#![allow(overflow)]
4+
#![allow(arithmetic_overflow)]
55

66
fn main() {
77
let x = 200u8 * 4;

src/test/run-fail/overflowing-neg.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// error-pattern:thread 'main' panicked at 'attempt to negate with overflow'
22
// compile-flags: -C debug-assertions
33

4-
#![allow(overflow)]
4+
#![allow(arithmetic_overflow)]
55

66
fn main() {
77
let _x = -std::i8::MIN;

src/test/run-fail/overflowing-rsh-1.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// error-pattern:thread 'main' panicked at 'attempt to shift right with overflow'
22
// compile-flags: -C debug-assertions
33

4-
#![warn(exceeding_bitshifts)]
4+
#![warn(arithmetic_overflow)]
55
#![warn(const_err)]
66

77
fn main() {

src/test/run-fail/overflowing-rsh-2.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// error-pattern:thread 'main' panicked at 'attempt to shift right with overflow'
22
// compile-flags: -C debug-assertions
33

4-
#![warn(exceeding_bitshifts)]
4+
#![warn(arithmetic_overflow)]
55
#![warn(const_err)]
66

77
fn main() {

src/test/run-fail/overflowing-rsh-3.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// error-pattern:thread 'main' panicked at 'attempt to shift right with overflow'
22
// compile-flags: -C debug-assertions
33

4-
#![warn(exceeding_bitshifts)]
4+
#![warn(arithmetic_overflow)]
55
#![warn(const_err)]
66

77
fn main() {

src/test/run-fail/overflowing-rsh-4.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
// This function is checking that our (type-based) automatic
55
// truncation does not sidestep the overflow checking.
66

7-
#![warn(exceeding_bitshifts)]
7+
#![warn(arithmetic_overflow)]
88
#![warn(const_err)]
99

1010
fn main() {

src/test/run-fail/overflowing-rsh-5.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// error-pattern:thread 'main' panicked at 'attempt to shift right with overflow'
22
// compile-flags: -C debug-assertions
33

4-
#![warn(exceeding_bitshifts)]
4+
#![warn(arithmetic_overflow)]
55
#![warn(const_err)]
66

77
fn main() {

src/test/run-fail/overflowing-rsh-6.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// error-pattern:thread 'main' panicked at 'attempt to shift right with overflow'
22
// compile-flags: -C debug-assertions
33

4-
#![warn(exceeding_bitshifts)]
4+
#![warn(arithmetic_overflow)]
55
#![warn(const_err)]
66
#![feature(const_indexing)]
77

src/test/run-fail/overflowing-sub.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// error-pattern:thread 'main' panicked at 'attempt to subtract with overflow'
22
// compile-flags: -C debug-assertions
33

4-
#![allow(overflow)]
4+
#![allow(arithmetic_overflow)]
55

66
fn main() {
77
let _x = 42u8 - (42u8 + 1);

src/test/run-fail/promoted_div_by_zero.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#![allow(panic, const_err)]
1+
#![allow(unconditional_panic, const_err)]
22

33
// error-pattern: attempt to divide by zero
44

src/test/run-fail/promoted_overflow.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#![allow(overflow)]
1+
#![allow(arithmetic_overflow)]
22

33
// error-pattern: overflow
44
// compile-flags: -C overflow-checks=yes

src/test/ui/consts/array-literal-index-oob.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// build-pass
22
// ignore-pass (emit codegen-time warnings and verify that they are indeed warnings and not errors)
33

4-
#![warn(const_err, panic)]
4+
#![warn(const_err, unconditional_panic)]
55

66
fn main() {
77
&{ [1, 2, 3][4] };

src/test/ui/consts/array-literal-index-oob.stderr

+3-3
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ LL | &{ [1, 2, 3][4] };
77
note: the lint level is defined here
88
--> $DIR/array-literal-index-oob.rs:4:20
99
|
10-
LL | #![warn(const_err, panic)]
11-
| ^^^^^
10+
LL | #![warn(const_err, unconditional_panic)]
11+
| ^^^^^^^^^^^^^^^^^^^
1212

1313
warning: reaching this expression at runtime will panic or abort
1414
--> $DIR/array-literal-index-oob.rs:7:8
@@ -21,7 +21,7 @@ LL | &{ [1, 2, 3][4] };
2121
note: the lint level is defined here
2222
--> $DIR/array-literal-index-oob.rs:4:9
2323
|
24-
LL | #![warn(const_err, panic)]
24+
LL | #![warn(const_err, unconditional_panic)]
2525
| ^^^^^^^^^
2626

2727
warning: erroneous constant used

src/test/ui/consts/const-err.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// build-fail
22
// compile-flags: -Zforce-overflow-checks=on
33

4-
#![allow(exceeding_bitshifts)]
4+
#![allow(arithmetic_overflow)]
55
#![warn(const_err)]
66

77
fn black_box<T>(_: T) {

src/test/ui/consts/const-err2.default.stderr

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ error: this arithmetic operation will overflow
44
LL | let a = -std::i8::MIN;
55
| ^^^^^^^^^^^^^ attempt to negate with overflow
66
|
7-
= note: `#[deny(overflow)]` on by default
7+
= note: `#[deny(arithmetic_overflow)]` on by default
88

99
error: this arithmetic operation will overflow
1010
--> $DIR/const-err2.rs:21:18
@@ -42,7 +42,7 @@ error: this operation will panic at runtime
4242
LL | let _e = [5u8][1];
4343
| ^^^^^^^^ index out of bounds: the len is 1 but the index is 1
4444
|
45-
= note: `#[deny(panic)]` on by default
45+
= note: `#[deny(unconditional_panic)]` on by default
4646

4747
error: aborting due to 7 previous errors
4848

src/test/ui/consts/const-err2.noopt.stderr

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ error: this arithmetic operation will overflow
44
LL | let a = -std::i8::MIN;
55
| ^^^^^^^^^^^^^ attempt to negate with overflow
66
|
7-
= note: `#[deny(overflow)]` on by default
7+
= note: `#[deny(arithmetic_overflow)]` on by default
88

99
error: this arithmetic operation will overflow
1010
--> $DIR/const-err2.rs:21:18
@@ -42,7 +42,7 @@ error: this operation will panic at runtime
4242
LL | let _e = [5u8][1];
4343
| ^^^^^^^^ index out of bounds: the len is 1 but the index is 1
4444
|
45-
= note: `#[deny(panic)]` on by default
45+
= note: `#[deny(unconditional_panic)]` on by default
4646

4747
error: aborting due to 7 previous errors
4848

src/test/ui/consts/const-err2.opt.stderr

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ error: this arithmetic operation will overflow
44
LL | let a = -std::i8::MIN;
55
| ^^^^^^^^^^^^^ attempt to negate with overflow
66
|
7-
= note: `#[deny(overflow)]` on by default
7+
= note: `#[deny(arithmetic_overflow)]` on by default
88

99
error: this arithmetic operation will overflow
1010
--> $DIR/const-err2.rs:21:18
@@ -42,7 +42,7 @@ error: this operation will panic at runtime
4242
LL | let _e = [5u8][1];
4343
| ^^^^^^^^ index out of bounds: the len is 1 but the index is 1
4444
|
45-
= note: `#[deny(panic)]` on by default
45+
= note: `#[deny(unconditional_panic)]` on by default
4646

4747
error: aborting due to 7 previous errors
4848

src/test/ui/consts/const-err2.opt_with_overflow_checks.stderr

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ error: this arithmetic operation will overflow
44
LL | let a = -std::i8::MIN;
55
| ^^^^^^^^^^^^^ attempt to negate with overflow
66
|
7-
= note: `#[deny(overflow)]` on by default
7+
= note: `#[deny(arithmetic_overflow)]` on by default
88

99
error: this arithmetic operation will overflow
1010
--> $DIR/const-err2.rs:21:18
@@ -42,7 +42,7 @@ error: this operation will panic at runtime
4242
LL | let _e = [5u8][1];
4343
| ^^^^^^^^ index out of bounds: the len is 1 but the index is 1
4444
|
45-
= note: `#[deny(panic)]` on by default
45+
= note: `#[deny(unconditional_panic)]` on by default
4646

4747
error: aborting due to 7 previous errors
4848

src/test/ui/consts/const-eval/index_out_of_bounds_propagated.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ error: this operation will panic at runtime
44
LL | array[1];
55
| ^^^^^^^^ index out of bounds: the len is 1 but the index is 1
66
|
7-
= note: `#[deny(panic)]` on by default
7+
= note: `#[deny(unconditional_panic)]` on by default
88

99
error: aborting due to previous error
1010

0 commit comments

Comments
 (0)