Make invalid integer operation messages consistent

This commit is contained in:
varkor 2020-09-15 20:34:50 +01:00
parent 6f9a8a7f9b
commit 8eb42ba0fb
71 changed files with 323 additions and 319 deletions

View file

@ -1300,49 +1300,49 @@ impl<O> AssertKind<O> {
match self { match self {
BoundsCheck { ref len, ref index } => write!( BoundsCheck { ref len, ref index } => write!(
f, f,
"\"index out of bounds: the len is {{}} but the index is {{}}\", {:?}, {:?}", "\"index out of bounds: the length is {{}} but the index is {{}}\", {:?}, {:?}",
len, index len, index
), ),
OverflowNeg(op) => { OverflowNeg(op) => {
write!(f, "\"attempt to negate {{}} which would overflow\", {:?}", op) write!(f, "\"attempt to negate `{{}}`, which would overflow\", {:?}", op)
} }
DivisionByZero(op) => write!(f, "\"attempt to divide {{}} by zero\", {:?}", op), DivisionByZero(op) => write!(f, "\"attempt to divide `{{}}` by zero\", {:?}", op),
RemainderByZero(op) => write!( RemainderByZero(op) => write!(
f, f,
"\"attempt to calculate the remainder of {{}} with a divisor of zero\", {:?}", "\"attempt to calculate the remainder of `{{}}` with a divisor of zero\", {:?}",
op op
), ),
Overflow(BinOp::Add, l, r) => write!( Overflow(BinOp::Add, l, r) => write!(
f, f,
"\"attempt to compute `{{}} + {{}}` which would overflow\", {:?}, {:?}", "\"attempt to compute `{{}} + {{}}`, which would overflow\", {:?}, {:?}",
l, r l, r
), ),
Overflow(BinOp::Sub, l, r) => write!( Overflow(BinOp::Sub, l, r) => write!(
f, f,
"\"attempt to compute `{{}} - {{}}` which would overflow\", {:?}, {:?}", "\"attempt to compute `{{}} - {{}}`, which would overflow\", {:?}, {:?}",
l, r l, r
), ),
Overflow(BinOp::Mul, l, r) => write!( Overflow(BinOp::Mul, l, r) => write!(
f, f,
"\"attempt to compute `{{}} * {{}}` which would overflow\", {:?}, {:?}", "\"attempt to compute `{{}} * {{}}`, which would overflow\", {:?}, {:?}",
l, r l, r
), ),
Overflow(BinOp::Div, l, r) => write!( Overflow(BinOp::Div, l, r) => write!(
f, f,
"\"attempt to compute `{{}} / {{}}` which would overflow\", {:?}, {:?}", "\"attempt to compute `{{}} / {{}}`, which would overflow\", {:?}, {:?}",
l, r l, r
), ),
Overflow(BinOp::Rem, l, r) => write!( Overflow(BinOp::Rem, l, r) => write!(
f, f,
"\"attempt to compute the remainder of `{{}} % {{}}` which would overflow\", {:?}, {:?}", "\"attempt to compute the remainder of `{{}} % {{}}`, which would overflow\", {:?}, {:?}",
l, r l, r
), ),
Overflow(BinOp::Shr, _, r) => { Overflow(BinOp::Shr, _, r) => {
write!(f, "\"attempt to shift right by {{}} which would overflow\", {:?}", r) write!(f, "\"attempt to shift right by `{{}}`, which would overflow\", {:?}", r)
} }
Overflow(BinOp::Shl, _, r) => { Overflow(BinOp::Shl, _, r) => {
write!(f, "\"attempt to shift left by {{}} which would overflow\", {:?}", r) write!(f, "\"attempt to shift left by `{{}}`, which would overflow\", {:?}", r)
} }
_ => write!(f, "\"{}\"", self.description()), _ => write!(f, "\"{}\"", self.description()),
} }
@ -1353,36 +1353,40 @@ impl<O: fmt::Debug> fmt::Debug for AssertKind<O> {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
use AssertKind::*; use AssertKind::*;
match self { match self {
BoundsCheck { ref len, ref index } => { BoundsCheck { ref len, ref index } => write!(
write!(f, "index out of bounds: the len is {:?} but the index is {:?}", len, index) f,
} "index out of bounds: the length is {:?} but the index is {:?}",
OverflowNeg(op) => write!(f, "attempt to negate {:#?} which would overflow", op), len, index
DivisionByZero(op) => write!(f, "attempt to divide {:#?} by zero", op), ),
RemainderByZero(op) => { OverflowNeg(op) => write!(f, "attempt to negate `{:#?}`, which would overflow", op),
write!(f, "attempt to calculate the remainder of {:#?} with a divisor of zero", op) DivisionByZero(op) => write!(f, "attempt to divide `{:#?}` by zero", op),
} RemainderByZero(op) => write!(
f,
"attempt to calculate the remainder of `{:#?}` with a divisor of zero",
op
),
Overflow(BinOp::Add, l, r) => { Overflow(BinOp::Add, l, r) => {
write!(f, "attempt to compute `{:#?} + {:#?}` which would overflow", l, r) write!(f, "attempt to compute `{:#?} + {:#?}`, which would overflow", l, r)
} }
Overflow(BinOp::Sub, l, r) => { Overflow(BinOp::Sub, l, r) => {
write!(f, "attempt to compute `{:#?} - {:#?}` which would overflow", l, r) write!(f, "attempt to compute `{:#?} - {:#?}`, which would overflow", l, r)
} }
Overflow(BinOp::Mul, l, r) => { Overflow(BinOp::Mul, l, r) => {
write!(f, "attempt to compute `{:#?} * {:#?}` which would overflow", l, r) write!(f, "attempt to compute `{:#?} * {:#?}`, which would overflow", l, r)
} }
Overflow(BinOp::Div, l, r) => { Overflow(BinOp::Div, l, r) => {
write!(f, "attempt to compute `{:#?} / {:#?}` which would overflow", l, r) write!(f, "attempt to compute `{:#?} / {:#?}`, which would overflow", l, r)
} }
Overflow(BinOp::Rem, l, r) => write!( Overflow(BinOp::Rem, l, r) => write!(
f, f,
"attempt to compute the remainder of `{:#?} % {:#?}` which would overflow", "attempt to compute the remainder of `{:#?} % {:#?}`, which would overflow",
l, r l, r
), ),
Overflow(BinOp::Shr, _, r) => { Overflow(BinOp::Shr, _, r) => {
write!(f, "attempt to shift right by {:#?} which would overflow", r) write!(f, "attempt to shift right by `{:#?}`, which would overflow", r)
} }
Overflow(BinOp::Shl, _, r) => { Overflow(BinOp::Shl, _, r) => {
write!(f, "attempt to shift left by {:#?} which would overflow", r) write!(f, "attempt to shift left by `{:#?}`, which would overflow", r)
} }
_ => write!(f, "{}", self.description()), _ => write!(f, "{}", self.description()),
} }

View file

@ -1,6 +1,6 @@
const A: &'static [i32] = &[]; const A: &'static [i32] = &[];
const B: i32 = (&A)[1]; const B: i32 = (&A)[1];
//~^ index out of bounds: the len is 0 but the index is 1 //~^ index out of bounds: the length is 0 but the index is 1
//~| ERROR any use of this value will cause an error //~| ERROR any use of this value will cause an error
fn main() { fn main() {

View file

@ -4,7 +4,7 @@ error: any use of this value will cause an error
LL | const B: i32 = (&A)[1]; LL | const B: i32 = (&A)[1];
| ---------------^^^^^^^- | ---------------^^^^^^^-
| | | |
| index out of bounds: the len is 0 but the index is 1 | index out of bounds: the length is 0 but the index is 1
| |
= note: `#[deny(const_err)]` on by default = note: `#[deny(const_err)]` on by default

View file

@ -1,6 +1,6 @@
const A: [i32; 0] = []; const A: [i32; 0] = [];
const B: i32 = A[1]; const B: i32 = A[1];
//~^ index out of bounds: the len is 0 but the index is 1 //~^ index out of bounds: the length is 0 but the index is 1
//~| ERROR any use of this value will cause an error //~| ERROR any use of this value will cause an error
fn main() { fn main() {

View file

@ -4,7 +4,7 @@ error: any use of this value will cause an error
LL | const B: i32 = A[1]; LL | const B: i32 = A[1];
| ---------------^^^^- | ---------------^^^^-
| | | |
| index out of bounds: the len is 0 but the index is 1 | index out of bounds: the length is 0 but the index is 1
| |
= note: `#[deny(const_err)]` on by default = note: `#[deny(const_err)]` on by default

View file

@ -4,7 +4,7 @@ error: any use of this value will cause an error
LL | const B: u8 = Self::A + 1; LL | const B: u8 = Self::A + 1;
| --------------^^^^^^^^^^^- | --------------^^^^^^^^^^^-
| | | |
| attempt to compute `u8::MAX + 1_u8` which would overflow | attempt to compute `u8::MAX + 1_u8`, which would overflow
| |
= note: `#[deny(const_err)]` on by default = note: `#[deny(const_err)]` on by default

View file

@ -2,7 +2,7 @@ error: this arithmetic operation will overflow
--> $DIR/issue-69020-assoc-const-arith-overflow.rs:29:22 --> $DIR/issue-69020-assoc-const-arith-overflow.rs:29:22
| |
LL | const NEG: i32 = -i32::MIN + T::NEG; LL | const NEG: i32 = -i32::MIN + T::NEG;
| ^^^^^^^^^ attempt to negate i32::MIN which would overflow | ^^^^^^^^^ attempt to negate `i32::MIN`, which would overflow
| |
= note: `#[deny(arithmetic_overflow)]` on by default = note: `#[deny(arithmetic_overflow)]` on by default
@ -10,25 +10,25 @@ error: this arithmetic operation will overflow
--> $DIR/issue-69020-assoc-const-arith-overflow.rs:31:35 --> $DIR/issue-69020-assoc-const-arith-overflow.rs:31:35
| |
LL | const NEG_REV: i32 = T::NEG + (-i32::MIN); LL | const NEG_REV: i32 = T::NEG + (-i32::MIN);
| ^^^^^^^^^^^ attempt to negate i32::MIN which would overflow | ^^^^^^^^^^^ attempt to negate `i32::MIN`, which would overflow
error: this arithmetic operation will overflow error: this arithmetic operation will overflow
--> $DIR/issue-69020-assoc-const-arith-overflow.rs:34:22 --> $DIR/issue-69020-assoc-const-arith-overflow.rs:34:22
| |
LL | const ADD: i32 = (i32::MAX+1) + T::ADD; LL | const ADD: i32 = (i32::MAX+1) + T::ADD;
| ^^^^^^^^^^^^ attempt to compute `i32::MAX + 1_i32` which would overflow | ^^^^^^^^^^^^ attempt to compute `i32::MAX + 1_i32`, which would overflow
error: this arithmetic operation will overflow error: this arithmetic operation will overflow
--> $DIR/issue-69020-assoc-const-arith-overflow.rs:36:36 --> $DIR/issue-69020-assoc-const-arith-overflow.rs:36:36
| |
LL | const ADD_REV: i32 = T::ADD + (i32::MAX+1); LL | const ADD_REV: i32 = T::ADD + (i32::MAX+1);
| ^^^^^^^^^^^^ attempt to compute `i32::MAX + 1_i32` which would overflow | ^^^^^^^^^^^^ attempt to compute `i32::MAX + 1_i32`, which would overflow
error: this operation will panic at runtime error: this operation will panic at runtime
--> $DIR/issue-69020-assoc-const-arith-overflow.rs:39:22 --> $DIR/issue-69020-assoc-const-arith-overflow.rs:39:22
| |
LL | const DIV: i32 = (1/0) + T::DIV; LL | const DIV: i32 = (1/0) + T::DIV;
| ^^^^^ attempt to divide 1_i32 by zero | ^^^^^ attempt to divide `1_i32` by zero
| |
= note: `#[deny(unconditional_panic)]` on by default = note: `#[deny(unconditional_panic)]` on by default
@ -36,19 +36,19 @@ error: this operation will panic at runtime
--> $DIR/issue-69020-assoc-const-arith-overflow.rs:41:35 --> $DIR/issue-69020-assoc-const-arith-overflow.rs:41:35
| |
LL | const DIV_REV: i32 = T::DIV + (1/0); LL | const DIV_REV: i32 = T::DIV + (1/0);
| ^^^^^ attempt to divide 1_i32 by zero | ^^^^^ attempt to divide `1_i32` by zero
error: this operation will panic at runtime error: this operation will panic at runtime
--> $DIR/issue-69020-assoc-const-arith-overflow.rs:44:22 --> $DIR/issue-69020-assoc-const-arith-overflow.rs:44:22
| |
LL | const OOB: i32 = [1][1] + T::OOB; LL | const OOB: i32 = [1][1] + T::OOB;
| ^^^^^^ index out of bounds: the len is 1 but the index is 1 | ^^^^^^ index out of bounds: the length is 1 but the index is 1
error: this operation will panic at runtime error: this operation will panic at runtime
--> $DIR/issue-69020-assoc-const-arith-overflow.rs:46:35 --> $DIR/issue-69020-assoc-const-arith-overflow.rs:46:35
| |
LL | const OOB_REV: i32 = T::OOB + [1][1]; LL | const OOB_REV: i32 = T::OOB + [1][1];
| ^^^^^^ index out of bounds: the len is 1 but the index is 1 | ^^^^^^ index out of bounds: the length is 1 but the index is 1
error: aborting due to 8 previous errors error: aborting due to 8 previous errors

View file

@ -2,7 +2,7 @@ error: this arithmetic operation will overflow
--> $DIR/issue-69020-assoc-const-arith-overflow.rs:29:22 --> $DIR/issue-69020-assoc-const-arith-overflow.rs:29:22
| |
LL | const NEG: i32 = -i32::MIN + T::NEG; LL | const NEG: i32 = -i32::MIN + T::NEG;
| ^^^^^^^^^ attempt to negate i32::MIN which would overflow | ^^^^^^^^^ attempt to negate `i32::MIN`, which would overflow
| |
= note: `#[deny(arithmetic_overflow)]` on by default = note: `#[deny(arithmetic_overflow)]` on by default
@ -10,25 +10,25 @@ error: this arithmetic operation will overflow
--> $DIR/issue-69020-assoc-const-arith-overflow.rs:31:35 --> $DIR/issue-69020-assoc-const-arith-overflow.rs:31:35
| |
LL | const NEG_REV: i32 = T::NEG + (-i32::MIN); LL | const NEG_REV: i32 = T::NEG + (-i32::MIN);
| ^^^^^^^^^^^ attempt to negate i32::MIN which would overflow | ^^^^^^^^^^^ attempt to negate `i32::MIN`, which would overflow
error: this arithmetic operation will overflow error: this arithmetic operation will overflow
--> $DIR/issue-69020-assoc-const-arith-overflow.rs:34:22 --> $DIR/issue-69020-assoc-const-arith-overflow.rs:34:22
| |
LL | const ADD: i32 = (i32::MAX+1) + T::ADD; LL | const ADD: i32 = (i32::MAX+1) + T::ADD;
| ^^^^^^^^^^^^ attempt to compute `i32::MAX + 1_i32` which would overflow | ^^^^^^^^^^^^ attempt to compute `i32::MAX + 1_i32`, which would overflow
error: this arithmetic operation will overflow error: this arithmetic operation will overflow
--> $DIR/issue-69020-assoc-const-arith-overflow.rs:36:36 --> $DIR/issue-69020-assoc-const-arith-overflow.rs:36:36
| |
LL | const ADD_REV: i32 = T::ADD + (i32::MAX+1); LL | const ADD_REV: i32 = T::ADD + (i32::MAX+1);
| ^^^^^^^^^^^^ attempt to compute `i32::MAX + 1_i32` which would overflow | ^^^^^^^^^^^^ attempt to compute `i32::MAX + 1_i32`, which would overflow
error: this operation will panic at runtime error: this operation will panic at runtime
--> $DIR/issue-69020-assoc-const-arith-overflow.rs:39:22 --> $DIR/issue-69020-assoc-const-arith-overflow.rs:39:22
| |
LL | const DIV: i32 = (1/0) + T::DIV; LL | const DIV: i32 = (1/0) + T::DIV;
| ^^^^^ attempt to divide 1_i32 by zero | ^^^^^ attempt to divide `1_i32` by zero
| |
= note: `#[deny(unconditional_panic)]` on by default = note: `#[deny(unconditional_panic)]` on by default
@ -36,19 +36,19 @@ error: this operation will panic at runtime
--> $DIR/issue-69020-assoc-const-arith-overflow.rs:41:35 --> $DIR/issue-69020-assoc-const-arith-overflow.rs:41:35
| |
LL | const DIV_REV: i32 = T::DIV + (1/0); LL | const DIV_REV: i32 = T::DIV + (1/0);
| ^^^^^ attempt to divide 1_i32 by zero | ^^^^^ attempt to divide `1_i32` by zero
error: this operation will panic at runtime error: this operation will panic at runtime
--> $DIR/issue-69020-assoc-const-arith-overflow.rs:44:22 --> $DIR/issue-69020-assoc-const-arith-overflow.rs:44:22
| |
LL | const OOB: i32 = [1][1] + T::OOB; LL | const OOB: i32 = [1][1] + T::OOB;
| ^^^^^^ index out of bounds: the len is 1 but the index is 1 | ^^^^^^ index out of bounds: the length is 1 but the index is 1
error: this operation will panic at runtime error: this operation will panic at runtime
--> $DIR/issue-69020-assoc-const-arith-overflow.rs:46:35 --> $DIR/issue-69020-assoc-const-arith-overflow.rs:46:35
| |
LL | const OOB_REV: i32 = T::OOB + [1][1]; LL | const OOB_REV: i32 = T::OOB + [1][1];
| ^^^^^^ index out of bounds: the len is 1 but the index is 1 | ^^^^^^ index out of bounds: the length is 1 but the index is 1
error: aborting due to 8 previous errors error: aborting due to 8 previous errors

View file

@ -2,7 +2,7 @@ error: this arithmetic operation will overflow
--> $DIR/issue-69020-assoc-const-arith-overflow.rs:29:22 --> $DIR/issue-69020-assoc-const-arith-overflow.rs:29:22
| |
LL | const NEG: i32 = -i32::MIN + T::NEG; LL | const NEG: i32 = -i32::MIN + T::NEG;
| ^^^^^^^^^ attempt to negate i32::MIN which would overflow | ^^^^^^^^^ attempt to negate `i32::MIN`, which would overflow
| |
= note: `#[deny(arithmetic_overflow)]` on by default = note: `#[deny(arithmetic_overflow)]` on by default
@ -10,25 +10,25 @@ error: this arithmetic operation will overflow
--> $DIR/issue-69020-assoc-const-arith-overflow.rs:31:35 --> $DIR/issue-69020-assoc-const-arith-overflow.rs:31:35
| |
LL | const NEG_REV: i32 = T::NEG + (-i32::MIN); LL | const NEG_REV: i32 = T::NEG + (-i32::MIN);
| ^^^^^^^^^^^ attempt to negate i32::MIN which would overflow | ^^^^^^^^^^^ attempt to negate `i32::MIN`, which would overflow
error: this arithmetic operation will overflow error: this arithmetic operation will overflow
--> $DIR/issue-69020-assoc-const-arith-overflow.rs:34:22 --> $DIR/issue-69020-assoc-const-arith-overflow.rs:34:22
| |
LL | const ADD: i32 = (i32::MAX+1) + T::ADD; LL | const ADD: i32 = (i32::MAX+1) + T::ADD;
| ^^^^^^^^^^^^ attempt to compute `i32::MAX + 1_i32` which would overflow | ^^^^^^^^^^^^ attempt to compute `i32::MAX + 1_i32`, which would overflow
error: this arithmetic operation will overflow error: this arithmetic operation will overflow
--> $DIR/issue-69020-assoc-const-arith-overflow.rs:36:36 --> $DIR/issue-69020-assoc-const-arith-overflow.rs:36:36
| |
LL | const ADD_REV: i32 = T::ADD + (i32::MAX+1); LL | const ADD_REV: i32 = T::ADD + (i32::MAX+1);
| ^^^^^^^^^^^^ attempt to compute `i32::MAX + 1_i32` which would overflow | ^^^^^^^^^^^^ attempt to compute `i32::MAX + 1_i32`, which would overflow
error: this operation will panic at runtime error: this operation will panic at runtime
--> $DIR/issue-69020-assoc-const-arith-overflow.rs:39:22 --> $DIR/issue-69020-assoc-const-arith-overflow.rs:39:22
| |
LL | const DIV: i32 = (1/0) + T::DIV; LL | const DIV: i32 = (1/0) + T::DIV;
| ^^^^^ attempt to divide 1_i32 by zero | ^^^^^ attempt to divide `1_i32` by zero
| |
= note: `#[deny(unconditional_panic)]` on by default = note: `#[deny(unconditional_panic)]` on by default
@ -36,19 +36,19 @@ error: this operation will panic at runtime
--> $DIR/issue-69020-assoc-const-arith-overflow.rs:41:35 --> $DIR/issue-69020-assoc-const-arith-overflow.rs:41:35
| |
LL | const DIV_REV: i32 = T::DIV + (1/0); LL | const DIV_REV: i32 = T::DIV + (1/0);
| ^^^^^ attempt to divide 1_i32 by zero | ^^^^^ attempt to divide `1_i32` by zero
error: this operation will panic at runtime error: this operation will panic at runtime
--> $DIR/issue-69020-assoc-const-arith-overflow.rs:44:22 --> $DIR/issue-69020-assoc-const-arith-overflow.rs:44:22
| |
LL | const OOB: i32 = [1][1] + T::OOB; LL | const OOB: i32 = [1][1] + T::OOB;
| ^^^^^^ index out of bounds: the len is 1 but the index is 1 | ^^^^^^ index out of bounds: the length is 1 but the index is 1
error: this operation will panic at runtime error: this operation will panic at runtime
--> $DIR/issue-69020-assoc-const-arith-overflow.rs:46:35 --> $DIR/issue-69020-assoc-const-arith-overflow.rs:46:35
| |
LL | const OOB_REV: i32 = T::OOB + [1][1]; LL | const OOB_REV: i32 = T::OOB + [1][1];
| ^^^^^^ index out of bounds: the len is 1 but the index is 1 | ^^^^^^ index out of bounds: the length is 1 but the index is 1
error: aborting due to 8 previous errors error: aborting due to 8 previous errors

View file

@ -2,7 +2,7 @@ error[E0080]: evaluation of constant value failed
--> $DIR/simple_fail.rs:7:33 --> $DIR/simple_fail.rs:7:33
| |
LL | type Arr<const N: usize> = [u8; N - 1]; LL | type Arr<const N: usize> = [u8; N - 1];
| ^^^^^ attempt to compute `0_usize - 1_usize` which would overflow | ^^^^^ attempt to compute `0_usize - 1_usize`, which would overflow
error: aborting due to previous error error: aborting due to previous error

View file

@ -2,7 +2,7 @@ warning: this operation will panic at runtime
--> $DIR/ice-assert-fail-div-by-zero.rs:11:5 --> $DIR/ice-assert-fail-div-by-zero.rs:11:5
| |
LL | f.0 / 0; LL | f.0 / 0;
| ^^^^^^^ attempt to divide _ by zero | ^^^^^^^ attempt to divide `_` by zero
| |
note: the lint level is defined here note: the lint level is defined here
--> $DIR/ice-assert-fail-div-by-zero.rs:5:9 --> $DIR/ice-assert-fail-div-by-zero.rs:5:9

View file

@ -2,7 +2,7 @@ warning: this operation will panic at runtime
--> $DIR/array-literal-index-oob.rs:7:8 --> $DIR/array-literal-index-oob.rs:7:8
| |
LL | &{ [1, 2, 3][4] }; LL | &{ [1, 2, 3][4] };
| ^^^^^^^^^^^^ index out of bounds: the len is 3 but the index is 4 | ^^^^^^^^^^^^ index out of bounds: the length is 3 but the index is 4
| |
note: the lint level is defined here note: the lint level is defined here
--> $DIR/array-literal-index-oob.rs:4:20 --> $DIR/array-literal-index-oob.rs:4:20

View file

@ -4,7 +4,7 @@ warning: any use of this value will cause an error
LL | const I_AM_ZERO_SIZED: () = [()][std::mem::size_of::<Self>()]; LL | const I_AM_ZERO_SIZED: () = [()][std::mem::size_of::<Self>()];
| -----------------------------^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^- | -----------------------------^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-
| | | |
| index out of bounds: the len is 1 but the index is 4 | index out of bounds: the length is 1 but the index is 4
| |
note: the lint level is defined here note: the lint level is defined here
--> $DIR/assoc_const_generic_impl.rs:3:9 --> $DIR/assoc_const_generic_impl.rs:3:9

View file

@ -5,7 +5,7 @@ const BAR: usize = FOO[5]; // no error, because the error below occurs before re
const BLUB: [u32; FOO[4]] = [5, 6]; const BLUB: [u32; FOO[4]] = [5, 6];
//~^ ERROR evaluation of constant value failed [E0080] //~^ ERROR evaluation of constant value failed [E0080]
//~| index out of bounds: the len is 3 but the index is 4 //~| index out of bounds: the length is 3 but the index is 4
fn main() { fn main() {
let _ = BAR; let _ = BAR;

View file

@ -2,7 +2,7 @@ error[E0080]: evaluation of constant value failed
--> $DIR/const-array-oob.rs:6:19 --> $DIR/const-array-oob.rs:6:19
| |
LL | const BLUB: [u32; FOO[4]] = [5, 6]; LL | const BLUB: [u32; FOO[4]] = [5, 6];
| ^^^^^^ index out of bounds: the len is 3 but the index is 4 | ^^^^^^ index out of bounds: the length is 3 but the index is 4
error: aborting due to previous error error: aborting due to previous error

View file

@ -4,7 +4,7 @@ error: any use of this value will cause an error
LL | pub const A: i8 = -std::i8::MIN; LL | pub const A: i8 = -std::i8::MIN;
| ------------------^^^^^^^^^^^^^- | ------------------^^^^^^^^^^^^^-
| | | |
| attempt to negate i8::MIN which would overflow | attempt to negate `i8::MIN`, which would overflow
| |
note: the lint level is defined here note: the lint level is defined here
--> $DIR/const-err-early.rs:1:9 --> $DIR/const-err-early.rs:1:9
@ -18,7 +18,7 @@ error: any use of this value will cause an error
LL | pub const B: u8 = 200u8 + 200u8; LL | pub const B: u8 = 200u8 + 200u8;
| ------------------^^^^^^^^^^^^^- | ------------------^^^^^^^^^^^^^-
| | | |
| attempt to compute `200_u8 + 200_u8` which would overflow | attempt to compute `200_u8 + 200_u8`, which would overflow
error: any use of this value will cause an error error: any use of this value will cause an error
--> $DIR/const-err-early.rs:5:19 --> $DIR/const-err-early.rs:5:19
@ -26,7 +26,7 @@ error: any use of this value will cause an error
LL | pub const C: u8 = 200u8 * 4; LL | pub const C: u8 = 200u8 * 4;
| ------------------^^^^^^^^^- | ------------------^^^^^^^^^-
| | | |
| attempt to compute `200_u8 * 4_u8` which would overflow | attempt to compute `200_u8 * 4_u8`, which would overflow
error: any use of this value will cause an error error: any use of this value will cause an error
--> $DIR/const-err-early.rs:6:19 --> $DIR/const-err-early.rs:6:19
@ -34,7 +34,7 @@ error: any use of this value will cause an error
LL | pub const D: u8 = 42u8 - (42u8 + 1); LL | pub const D: u8 = 42u8 - (42u8 + 1);
| ------------------^^^^^^^^^^^^^^^^^- | ------------------^^^^^^^^^^^^^^^^^-
| | | |
| attempt to compute `42_u8 - 43_u8` which would overflow | attempt to compute `42_u8 - 43_u8`, which would overflow
error: any use of this value will cause an error error: any use of this value will cause an error
--> $DIR/const-err-early.rs:7:19 --> $DIR/const-err-early.rs:7:19
@ -42,7 +42,7 @@ error: any use of this value will cause an error
LL | pub const E: u8 = [5u8][1]; LL | pub const E: u8 = [5u8][1];
| ------------------^^^^^^^^- | ------------------^^^^^^^^-
| | | |
| index out of bounds: the len is 1 but the index is 1 | index out of bounds: the length is 1 but the index is 1
error: aborting due to 5 previous errors error: aborting due to 5 previous errors

View file

@ -4,7 +4,7 @@ error: any use of this value will cause an error
LL | pub const A: i8 = -std::i8::MIN; LL | pub const A: i8 = -std::i8::MIN;
| ------------------^^^^^^^^^^^^^- | ------------------^^^^^^^^^^^^^-
| | | |
| attempt to negate i8::MIN which would overflow | attempt to negate `i8::MIN`, which would overflow
| |
note: the lint level is defined here note: the lint level is defined here
--> $DIR/const-err-multi.rs:1:9 --> $DIR/const-err-multi.rs:1:9

View file

@ -4,7 +4,7 @@ warning: any use of this value will cause an error
LL | const FOO: u8 = [5u8][1]; LL | const FOO: u8 = [5u8][1];
| ----------------^^^^^^^^- | ----------------^^^^^^^^-
| | | |
| index out of bounds: the len is 1 but the index is 1 | index out of bounds: the length is 1 but the index is 1
| |
note: the lint level is defined here note: the lint level is defined here
--> $DIR/const-err.rs:5:9 --> $DIR/const-err.rs:5:9

View file

@ -2,7 +2,7 @@ error: this arithmetic operation will overflow
--> $DIR/const-err2.rs:19:13 --> $DIR/const-err2.rs:19:13
| |
LL | let a = -std::i8::MIN; LL | let a = -std::i8::MIN;
| ^^^^^^^^^^^^^ attempt to negate i8::MIN which would overflow | ^^^^^^^^^^^^^ attempt to negate `i8::MIN`, which would overflow
| |
= note: `#[deny(arithmetic_overflow)]` on by default = note: `#[deny(arithmetic_overflow)]` on by default
@ -10,37 +10,37 @@ error: this arithmetic operation will overflow
--> $DIR/const-err2.rs:21:18 --> $DIR/const-err2.rs:21:18
| |
LL | let a_i128 = -std::i128::MIN; LL | let a_i128 = -std::i128::MIN;
| ^^^^^^^^^^^^^^^ attempt to negate i128::MIN which would overflow | ^^^^^^^^^^^^^^^ attempt to negate `i128::MIN`, which would overflow
error: this arithmetic operation will overflow error: this arithmetic operation will overflow
--> $DIR/const-err2.rs:23:13 --> $DIR/const-err2.rs:23:13
| |
LL | let b = 200u8 + 200u8 + 200u8; LL | let b = 200u8 + 200u8 + 200u8;
| ^^^^^^^^^^^^^ attempt to compute `200_u8 + 200_u8` which would overflow | ^^^^^^^^^^^^^ attempt to compute `200_u8 + 200_u8`, which would overflow
error: this arithmetic operation will overflow error: this arithmetic operation will overflow
--> $DIR/const-err2.rs:25:18 --> $DIR/const-err2.rs:25:18
| |
LL | let b_i128 = std::i128::MIN - std::i128::MAX; LL | let b_i128 = std::i128::MIN - std::i128::MAX;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ attempt to compute `i128::MIN - i128::MAX` which would overflow | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ attempt to compute `i128::MIN - i128::MAX`, which would overflow
error: this arithmetic operation will overflow error: this arithmetic operation will overflow
--> $DIR/const-err2.rs:27:13 --> $DIR/const-err2.rs:27:13
| |
LL | let c = 200u8 * 4; LL | let c = 200u8 * 4;
| ^^^^^^^^^ attempt to compute `200_u8 * 4_u8` which would overflow | ^^^^^^^^^ attempt to compute `200_u8 * 4_u8`, which would overflow
error: this arithmetic operation will overflow error: this arithmetic operation will overflow
--> $DIR/const-err2.rs:29:13 --> $DIR/const-err2.rs:29:13
| |
LL | let d = 42u8 - (42u8 + 1); LL | let d = 42u8 - (42u8 + 1);
| ^^^^^^^^^^^^^^^^^ attempt to compute `42_u8 - 43_u8` which would overflow | ^^^^^^^^^^^^^^^^^ attempt to compute `42_u8 - 43_u8`, which would overflow
error: this operation will panic at runtime error: this operation will panic at runtime
--> $DIR/const-err2.rs:31:14 --> $DIR/const-err2.rs:31:14
| |
LL | let _e = [5u8][1]; LL | let _e = [5u8][1];
| ^^^^^^^^ index out of bounds: the len is 1 but the index is 1 | ^^^^^^^^ index out of bounds: the length is 1 but the index is 1
| |
= note: `#[deny(unconditional_panic)]` on by default = note: `#[deny(unconditional_panic)]` on by default

View file

@ -2,7 +2,7 @@ error: this arithmetic operation will overflow
--> $DIR/const-err2.rs:19:13 --> $DIR/const-err2.rs:19:13
| |
LL | let a = -std::i8::MIN; LL | let a = -std::i8::MIN;
| ^^^^^^^^^^^^^ attempt to negate i8::MIN which would overflow | ^^^^^^^^^^^^^ attempt to negate `i8::MIN`, which would overflow
| |
= note: `#[deny(arithmetic_overflow)]` on by default = note: `#[deny(arithmetic_overflow)]` on by default
@ -10,37 +10,37 @@ error: this arithmetic operation will overflow
--> $DIR/const-err2.rs:21:18 --> $DIR/const-err2.rs:21:18
| |
LL | let a_i128 = -std::i128::MIN; LL | let a_i128 = -std::i128::MIN;
| ^^^^^^^^^^^^^^^ attempt to negate i128::MIN which would overflow | ^^^^^^^^^^^^^^^ attempt to negate `i128::MIN`, which would overflow
error: this arithmetic operation will overflow error: this arithmetic operation will overflow
--> $DIR/const-err2.rs:23:13 --> $DIR/const-err2.rs:23:13
| |
LL | let b = 200u8 + 200u8 + 200u8; LL | let b = 200u8 + 200u8 + 200u8;
| ^^^^^^^^^^^^^ attempt to compute `200_u8 + 200_u8` which would overflow | ^^^^^^^^^^^^^ attempt to compute `200_u8 + 200_u8`, which would overflow
error: this arithmetic operation will overflow error: this arithmetic operation will overflow
--> $DIR/const-err2.rs:25:18 --> $DIR/const-err2.rs:25:18
| |
LL | let b_i128 = std::i128::MIN - std::i128::MAX; LL | let b_i128 = std::i128::MIN - std::i128::MAX;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ attempt to compute `i128::MIN - i128::MAX` which would overflow | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ attempt to compute `i128::MIN - i128::MAX`, which would overflow
error: this arithmetic operation will overflow error: this arithmetic operation will overflow
--> $DIR/const-err2.rs:27:13 --> $DIR/const-err2.rs:27:13
| |
LL | let c = 200u8 * 4; LL | let c = 200u8 * 4;
| ^^^^^^^^^ attempt to compute `200_u8 * 4_u8` which would overflow | ^^^^^^^^^ attempt to compute `200_u8 * 4_u8`, which would overflow
error: this arithmetic operation will overflow error: this arithmetic operation will overflow
--> $DIR/const-err2.rs:29:13 --> $DIR/const-err2.rs:29:13
| |
LL | let d = 42u8 - (42u8 + 1); LL | let d = 42u8 - (42u8 + 1);
| ^^^^^^^^^^^^^^^^^ attempt to compute `42_u8 - 43_u8` which would overflow | ^^^^^^^^^^^^^^^^^ attempt to compute `42_u8 - 43_u8`, which would overflow
error: this operation will panic at runtime error: this operation will panic at runtime
--> $DIR/const-err2.rs:31:14 --> $DIR/const-err2.rs:31:14
| |
LL | let _e = [5u8][1]; LL | let _e = [5u8][1];
| ^^^^^^^^ index out of bounds: the len is 1 but the index is 1 | ^^^^^^^^ index out of bounds: the length is 1 but the index is 1
| |
= note: `#[deny(unconditional_panic)]` on by default = note: `#[deny(unconditional_panic)]` on by default

View file

@ -2,7 +2,7 @@ error: this arithmetic operation will overflow
--> $DIR/const-err2.rs:19:13 --> $DIR/const-err2.rs:19:13
| |
LL | let a = -std::i8::MIN; LL | let a = -std::i8::MIN;
| ^^^^^^^^^^^^^ attempt to negate i8::MIN which would overflow | ^^^^^^^^^^^^^ attempt to negate `i8::MIN`, which would overflow
| |
= note: `#[deny(arithmetic_overflow)]` on by default = note: `#[deny(arithmetic_overflow)]` on by default
@ -10,37 +10,37 @@ error: this arithmetic operation will overflow
--> $DIR/const-err2.rs:21:18 --> $DIR/const-err2.rs:21:18
| |
LL | let a_i128 = -std::i128::MIN; LL | let a_i128 = -std::i128::MIN;
| ^^^^^^^^^^^^^^^ attempt to negate i128::MIN which would overflow | ^^^^^^^^^^^^^^^ attempt to negate `i128::MIN`, which would overflow
error: this arithmetic operation will overflow error: this arithmetic operation will overflow
--> $DIR/const-err2.rs:23:13 --> $DIR/const-err2.rs:23:13
| |
LL | let b = 200u8 + 200u8 + 200u8; LL | let b = 200u8 + 200u8 + 200u8;
| ^^^^^^^^^^^^^ attempt to compute `200_u8 + 200_u8` which would overflow | ^^^^^^^^^^^^^ attempt to compute `200_u8 + 200_u8`, which would overflow
error: this arithmetic operation will overflow error: this arithmetic operation will overflow
--> $DIR/const-err2.rs:25:18 --> $DIR/const-err2.rs:25:18
| |
LL | let b_i128 = std::i128::MIN - std::i128::MAX; LL | let b_i128 = std::i128::MIN - std::i128::MAX;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ attempt to compute `i128::MIN - i128::MAX` which would overflow | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ attempt to compute `i128::MIN - i128::MAX`, which would overflow
error: this arithmetic operation will overflow error: this arithmetic operation will overflow
--> $DIR/const-err2.rs:27:13 --> $DIR/const-err2.rs:27:13
| |
LL | let c = 200u8 * 4; LL | let c = 200u8 * 4;
| ^^^^^^^^^ attempt to compute `200_u8 * 4_u8` which would overflow | ^^^^^^^^^ attempt to compute `200_u8 * 4_u8`, which would overflow
error: this arithmetic operation will overflow error: this arithmetic operation will overflow
--> $DIR/const-err2.rs:29:13 --> $DIR/const-err2.rs:29:13
| |
LL | let d = 42u8 - (42u8 + 1); LL | let d = 42u8 - (42u8 + 1);
| ^^^^^^^^^^^^^^^^^ attempt to compute `42_u8 - 43_u8` which would overflow | ^^^^^^^^^^^^^^^^^ attempt to compute `42_u8 - 43_u8`, which would overflow
error: this operation will panic at runtime error: this operation will panic at runtime
--> $DIR/const-err2.rs:31:14 --> $DIR/const-err2.rs:31:14
| |
LL | let _e = [5u8][1]; LL | let _e = [5u8][1];
| ^^^^^^^^ index out of bounds: the len is 1 but the index is 1 | ^^^^^^^^ index out of bounds: the length is 1 but the index is 1
| |
= note: `#[deny(unconditional_panic)]` on by default = note: `#[deny(unconditional_panic)]` on by default

View file

@ -4,7 +4,7 @@ warning: any use of this value will cause an error
LL | const FOO: u32 = [X - Y, Y - X][(X < Y) as usize]; LL | const FOO: u32 = [X - Y, Y - X][(X < Y) as usize];
| ------------------^^^^^--------------------------- | ------------------^^^^^---------------------------
| | | |
| attempt to compute `5_u32 - 6_u32` which would overflow | attempt to compute `5_u32 - 6_u32`, which would overflow
| |
note: the lint level is defined here note: the lint level is defined here
--> $DIR/conditional_array_execution.rs:3:9 --> $DIR/conditional_array_execution.rs:3:9

View file

@ -2,7 +2,7 @@ error[E0080]: evaluation of constant value failed
--> $DIR/const-eval-overflow-3.rs:20:11 --> $DIR/const-eval-overflow-3.rs:20:11
| |
LL | = [0; (i8::MAX + 1) as usize]; LL | = [0; (i8::MAX + 1) as usize];
| ^^^^^^^^^^^^^ attempt to compute `i8::MAX + 1_i8` which would overflow | ^^^^^^^^^^^^^ attempt to compute `i8::MAX + 1_i8`, which would overflow
error: aborting due to previous error error: aborting due to previous error

View file

@ -2,7 +2,7 @@ error[E0080]: evaluation of constant value failed
--> $DIR/const-eval-overflow-4.rs:13:13 --> $DIR/const-eval-overflow-4.rs:13:13
| |
LL | : [u32; (i8::MAX as i8 + 1i8) as usize] LL | : [u32; (i8::MAX as i8 + 1i8) as usize]
| ^^^^^^^^^^^^^^^^^^^^^ attempt to compute `i8::MAX + 1_i8` which would overflow | ^^^^^^^^^^^^^^^^^^^^^ attempt to compute `i8::MAX + 1_i8`, which would overflow
error: aborting due to previous error error: aborting due to previous error

View file

@ -4,7 +4,7 @@ error: any use of this value will cause an error
LL | / const VALS_I8: (i8,) = LL | / const VALS_I8: (i8,) =
LL | | ( LL | | (
LL | | i8::MIN - 1, LL | | i8::MIN - 1,
| | ^^^^^^^^^^^ attempt to compute `i8::MIN - 1_i8` which would overflow | | ^^^^^^^^^^^ attempt to compute `i8::MIN - 1_i8`, which would overflow
LL | | ); LL | | );
| |_______- | |_______-
| |
@ -20,7 +20,7 @@ error: any use of this value will cause an error
LL | / const VALS_I16: (i16,) = LL | / const VALS_I16: (i16,) =
LL | | ( LL | | (
LL | | i16::MIN - 1, LL | | i16::MIN - 1,
| | ^^^^^^^^^^^^ attempt to compute `i16::MIN - 1_i16` which would overflow | | ^^^^^^^^^^^^ attempt to compute `i16::MIN - 1_i16`, which would overflow
LL | | ); LL | | );
| |_______- | |_______-
@ -30,7 +30,7 @@ error: any use of this value will cause an error
LL | / const VALS_I32: (i32,) = LL | / const VALS_I32: (i32,) =
LL | | ( LL | | (
LL | | i32::MIN - 1, LL | | i32::MIN - 1,
| | ^^^^^^^^^^^^ attempt to compute `i32::MIN - 1_i32` which would overflow | | ^^^^^^^^^^^^ attempt to compute `i32::MIN - 1_i32`, which would overflow
LL | | ); LL | | );
| |_______- | |_______-
@ -40,7 +40,7 @@ error: any use of this value will cause an error
LL | / const VALS_I64: (i64,) = LL | / const VALS_I64: (i64,) =
LL | | ( LL | | (
LL | | i64::MIN - 1, LL | | i64::MIN - 1,
| | ^^^^^^^^^^^^ attempt to compute `i64::MIN - 1_i64` which would overflow | | ^^^^^^^^^^^^ attempt to compute `i64::MIN - 1_i64`, which would overflow
LL | | ); LL | | );
| |_______- | |_______-
@ -50,7 +50,7 @@ error: any use of this value will cause an error
LL | / const VALS_U8: (u8,) = LL | / const VALS_U8: (u8,) =
LL | | ( LL | | (
LL | | u8::MIN - 1, LL | | u8::MIN - 1,
| | ^^^^^^^^^^^ attempt to compute `0_u8 - 1_u8` which would overflow | | ^^^^^^^^^^^ attempt to compute `0_u8 - 1_u8`, which would overflow
LL | | ); LL | | );
| |_______- | |_______-
@ -59,7 +59,7 @@ error: any use of this value will cause an error
| |
LL | / const VALS_U16: (u16,) = ( LL | / const VALS_U16: (u16,) = (
LL | | u16::MIN - 1, LL | | u16::MIN - 1,
| | ^^^^^^^^^^^^ attempt to compute `0_u16 - 1_u16` which would overflow | | ^^^^^^^^^^^^ attempt to compute `0_u16 - 1_u16`, which would overflow
LL | | ); LL | | );
| |_______- | |_______-
@ -68,7 +68,7 @@ error: any use of this value will cause an error
| |
LL | / const VALS_U32: (u32,) = ( LL | / const VALS_U32: (u32,) = (
LL | | u32::MIN - 1, LL | | u32::MIN - 1,
| | ^^^^^^^^^^^^ attempt to compute `0_u32 - 1_u32` which would overflow | | ^^^^^^^^^^^^ attempt to compute `0_u32 - 1_u32`, which would overflow
LL | | ); LL | | );
| |_______- | |_______-
@ -78,7 +78,7 @@ error: any use of this value will cause an error
LL | / const VALS_U64: (u64,) = LL | / const VALS_U64: (u64,) =
LL | | ( LL | | (
LL | | u64::MIN - 1, LL | | u64::MIN - 1,
| | ^^^^^^^^^^^^ attempt to compute `0_u64 - 1_u64` which would overflow | | ^^^^^^^^^^^^ attempt to compute `0_u64 - 1_u64`, which would overflow
LL | | ); LL | | );
| |_______- | |_______-

View file

@ -4,7 +4,7 @@ error: any use of this value will cause an error
LL | / const VALS_I8: (i8,) = LL | / const VALS_I8: (i8,) =
LL | | ( LL | | (
LL | | i8::MAX + 1, LL | | i8::MAX + 1,
| | ^^^^^^^^^^^ attempt to compute `i8::MAX + 1_i8` which would overflow | | ^^^^^^^^^^^ attempt to compute `i8::MAX + 1_i8`, which would overflow
LL | | ); LL | | );
| |_______- | |_______-
| |
@ -20,7 +20,7 @@ error: any use of this value will cause an error
LL | / const VALS_I16: (i16,) = LL | / const VALS_I16: (i16,) =
LL | | ( LL | | (
LL | | i16::MAX + 1, LL | | i16::MAX + 1,
| | ^^^^^^^^^^^^ attempt to compute `i16::MAX + 1_i16` which would overflow | | ^^^^^^^^^^^^ attempt to compute `i16::MAX + 1_i16`, which would overflow
LL | | ); LL | | );
| |_______- | |_______-
@ -30,7 +30,7 @@ error: any use of this value will cause an error
LL | / const VALS_I32: (i32,) = LL | / const VALS_I32: (i32,) =
LL | | ( LL | | (
LL | | i32::MAX + 1, LL | | i32::MAX + 1,
| | ^^^^^^^^^^^^ attempt to compute `i32::MAX + 1_i32` which would overflow | | ^^^^^^^^^^^^ attempt to compute `i32::MAX + 1_i32`, which would overflow
LL | | ); LL | | );
| |_______- | |_______-
@ -40,7 +40,7 @@ error: any use of this value will cause an error
LL | / const VALS_I64: (i64,) = LL | / const VALS_I64: (i64,) =
LL | | ( LL | | (
LL | | i64::MAX + 1, LL | | i64::MAX + 1,
| | ^^^^^^^^^^^^ attempt to compute `i64::MAX + 1_i64` which would overflow | | ^^^^^^^^^^^^ attempt to compute `i64::MAX + 1_i64`, which would overflow
LL | | ); LL | | );
| |_______- | |_______-
@ -50,7 +50,7 @@ error: any use of this value will cause an error
LL | / const VALS_U8: (u8,) = LL | / const VALS_U8: (u8,) =
LL | | ( LL | | (
LL | | u8::MAX + 1, LL | | u8::MAX + 1,
| | ^^^^^^^^^^^ attempt to compute `u8::MAX + 1_u8` which would overflow | | ^^^^^^^^^^^ attempt to compute `u8::MAX + 1_u8`, which would overflow
LL | | ); LL | | );
| |_______- | |_______-
@ -59,7 +59,7 @@ error: any use of this value will cause an error
| |
LL | / const VALS_U16: (u16,) = ( LL | / const VALS_U16: (u16,) = (
LL | | u16::MAX + 1, LL | | u16::MAX + 1,
| | ^^^^^^^^^^^^ attempt to compute `u16::MAX + 1_u16` which would overflow | | ^^^^^^^^^^^^ attempt to compute `u16::MAX + 1_u16`, which would overflow
LL | | ); LL | | );
| |_______- | |_______-
@ -68,7 +68,7 @@ error: any use of this value will cause an error
| |
LL | / const VALS_U32: (u32,) = ( LL | / const VALS_U32: (u32,) = (
LL | | u32::MAX + 1, LL | | u32::MAX + 1,
| | ^^^^^^^^^^^^ attempt to compute `u32::MAX + 1_u32` which would overflow | | ^^^^^^^^^^^^ attempt to compute `u32::MAX + 1_u32`, which would overflow
LL | | ); LL | | );
| |_______- | |_______-
@ -78,7 +78,7 @@ error: any use of this value will cause an error
LL | / const VALS_U64: (u64,) = LL | / const VALS_U64: (u64,) =
LL | | ( LL | | (
LL | | u64::MAX + 1, LL | | u64::MAX + 1,
| | ^^^^^^^^^^^^ attempt to compute `u64::MAX + 1_u64` which would overflow | | ^^^^^^^^^^^^ attempt to compute `u64::MAX + 1_u64`, which would overflow
LL | | ); LL | | );
| |_______- | |_______-

View file

@ -4,7 +4,7 @@ error: any use of this value will cause an error
LL | / const VALS_I8: (i8,) = LL | / const VALS_I8: (i8,) =
LL | | ( LL | | (
LL | | i8::MIN * 2, LL | | i8::MIN * 2,
| | ^^^^^^^^^^^ attempt to compute `i8::MIN * 2_i8` which would overflow | | ^^^^^^^^^^^ attempt to compute `i8::MIN * 2_i8`, which would overflow
LL | | ); LL | | );
| |_______- | |_______-
| |
@ -20,7 +20,7 @@ error: any use of this value will cause an error
LL | / const VALS_I16: (i16,) = LL | / const VALS_I16: (i16,) =
LL | | ( LL | | (
LL | | i16::MIN * 2, LL | | i16::MIN * 2,
| | ^^^^^^^^^^^^ attempt to compute `i16::MIN * 2_i16` which would overflow | | ^^^^^^^^^^^^ attempt to compute `i16::MIN * 2_i16`, which would overflow
LL | | ); LL | | );
| |_______- | |_______-
@ -30,7 +30,7 @@ error: any use of this value will cause an error
LL | / const VALS_I32: (i32,) = LL | / const VALS_I32: (i32,) =
LL | | ( LL | | (
LL | | i32::MIN * 2, LL | | i32::MIN * 2,
| | ^^^^^^^^^^^^ attempt to compute `i32::MIN * 2_i32` which would overflow | | ^^^^^^^^^^^^ attempt to compute `i32::MIN * 2_i32`, which would overflow
LL | | ); LL | | );
| |_______- | |_______-
@ -40,7 +40,7 @@ error: any use of this value will cause an error
LL | / const VALS_I64: (i64,) = LL | / const VALS_I64: (i64,) =
LL | | ( LL | | (
LL | | i64::MIN * 2, LL | | i64::MIN * 2,
| | ^^^^^^^^^^^^ attempt to compute `i64::MIN * 2_i64` which would overflow | | ^^^^^^^^^^^^ attempt to compute `i64::MIN * 2_i64`, which would overflow
LL | | ); LL | | );
| |_______- | |_______-
@ -50,7 +50,7 @@ error: any use of this value will cause an error
LL | / const VALS_U8: (u8,) = LL | / const VALS_U8: (u8,) =
LL | | ( LL | | (
LL | | u8::MAX * 2, LL | | u8::MAX * 2,
| | ^^^^^^^^^^^ attempt to compute `u8::MAX * 2_u8` which would overflow | | ^^^^^^^^^^^ attempt to compute `u8::MAX * 2_u8`, which would overflow
LL | | ); LL | | );
| |_______- | |_______-
@ -59,7 +59,7 @@ error: any use of this value will cause an error
| |
LL | / const VALS_U16: (u16,) = ( LL | / const VALS_U16: (u16,) = (
LL | | u16::MAX * 2, LL | | u16::MAX * 2,
| | ^^^^^^^^^^^^ attempt to compute `u16::MAX * 2_u16` which would overflow | | ^^^^^^^^^^^^ attempt to compute `u16::MAX * 2_u16`, which would overflow
LL | | ); LL | | );
| |_______- | |_______-
@ -68,7 +68,7 @@ error: any use of this value will cause an error
| |
LL | / const VALS_U32: (u32,) = ( LL | / const VALS_U32: (u32,) = (
LL | | u32::MAX * 2, LL | | u32::MAX * 2,
| | ^^^^^^^^^^^^ attempt to compute `u32::MAX * 2_u32` which would overflow | | ^^^^^^^^^^^^ attempt to compute `u32::MAX * 2_u32`, which would overflow
LL | | ); LL | | );
| |_______- | |_______-
@ -78,7 +78,7 @@ error: any use of this value will cause an error
LL | / const VALS_U64: (u64,) = LL | / const VALS_U64: (u64,) =
LL | | ( LL | | (
LL | | u64::MAX * 2, LL | | u64::MAX * 2,
| | ^^^^^^^^^^^^ attempt to compute `u64::MAX * 2_u64` which would overflow | | ^^^^^^^^^^^^ attempt to compute `u64::MAX * 2_u64`, which would overflow
LL | | ); LL | | );
| |_______- | |_______-

View file

@ -2,7 +2,7 @@ warning: this operation will panic at runtime
--> $DIR/erroneous-const.rs:6:22 --> $DIR/erroneous-const.rs:6:22
| |
LL | const VOID: () = [()][2]; LL | const VOID: () = [()][2];
| ^^^^^^^ index out of bounds: the len is 1 but the index is 2 | ^^^^^^^ index out of bounds: the length is 1 but the index is 2
| |
note: the lint level is defined here note: the lint level is defined here
--> $DIR/erroneous-const.rs:2:20 --> $DIR/erroneous-const.rs:2:20
@ -16,7 +16,7 @@ warning: any use of this value will cause an error
LL | const VOID: () = [()][2]; LL | const VOID: () = [()][2];
| -----------------^^^^^^^- | -----------------^^^^^^^-
| | | |
| index out of bounds: the len is 1 but the index is 2 | index out of bounds: the length is 1 but the index is 2
| |
note: the lint level is defined here note: the lint level is defined here
--> $DIR/erroneous-const.rs:2:9 --> $DIR/erroneous-const.rs:2:9

View file

@ -4,7 +4,7 @@ warning: any use of this value will cause an error
LL | const VOID: ! = { let x = 0 * std::mem::size_of::<T>(); [][x] }; LL | const VOID: ! = { let x = 0 * std::mem::size_of::<T>(); [][x] };
| --------------------------------------------------------^^^^^--- | --------------------------------------------------------^^^^^---
| | | |
| index out of bounds: the len is 0 but the index is 0 | index out of bounds: the length is 0 but the index is 0
| |
note: the lint level is defined here note: the lint level is defined here
--> $DIR/index-out-of-bounds-never-type.rs:4:9 --> $DIR/index-out-of-bounds-never-type.rs:4:9

View file

@ -2,7 +2,7 @@ error[E0080]: could not evaluate static initializer
--> $DIR/index_out_of_bounds.rs:1:19 --> $DIR/index_out_of_bounds.rs:1:19
| |
LL | static FOO: i32 = [][0]; LL | static FOO: i32 = [][0];
| ^^^^^ index out of bounds: the len is 0 but the index is 0 | ^^^^^ index out of bounds: the length is 0 but the index is 0
error: aborting due to previous error error: aborting due to previous error

View file

@ -2,7 +2,7 @@ error: this operation will panic at runtime
--> $DIR/index_out_of_bounds_propagated.rs:5:5 --> $DIR/index_out_of_bounds_propagated.rs:5:5
| |
LL | array[1]; LL | array[1];
| ^^^^^^^^ index out of bounds: the len is 1 but the index is 1 | ^^^^^^^^ index out of bounds: the length is 1 but the index is 1
| |
= note: `#[deny(unconditional_panic)]` on by default = note: `#[deny(unconditional_panic)]` on by default

View file

@ -4,7 +4,7 @@ warning: any use of this value will cause an error
LL | const X: u32 = 0 - 1; LL | const X: u32 = 0 - 1;
| ---------------^^^^^- | ---------------^^^^^-
| | | |
| attempt to compute `0_u32 - 1_u32` which would overflow | attempt to compute `0_u32 - 1_u32`, which would overflow
| |
note: the lint level is defined here note: the lint level is defined here
--> $DIR/issue-43197.rs:3:9 --> $DIR/issue-43197.rs:3:9
@ -18,7 +18,7 @@ warning: any use of this value will cause an error
LL | const Y: u32 = foo(0 - 1); LL | const Y: u32 = foo(0 - 1);
| -------------------^^^^^-- | -------------------^^^^^--
| | | |
| attempt to compute `0_u32 - 1_u32` which would overflow | attempt to compute `0_u32 - 1_u32`, which would overflow
error[E0080]: evaluation of constant expression failed error[E0080]: evaluation of constant expression failed
--> $DIR/issue-43197.rs:14:23 --> $DIR/issue-43197.rs:14:23

View file

@ -4,7 +4,7 @@ error: any use of this value will cause an error
LL | const BAR: usize = [5, 6, 7][T::BOO]; LL | const BAR: usize = [5, 6, 7][T::BOO];
| -------------------^^^^^^^^^^^^^^^^^- | -------------------^^^^^^^^^^^^^^^^^-
| | | |
| index out of bounds: the len is 3 but the index is 42 | index out of bounds: the length is 3 but the index is 42
| |
= note: `#[deny(const_err)]` on by default = note: `#[deny(const_err)]` on by default

View file

@ -4,7 +4,7 @@ error: any use of this value will cause an error
LL | const MAX: u8 = A::MAX + B::MAX; LL | const MAX: u8 = A::MAX + B::MAX;
| ----------------^^^^^^^^^^^^^^^- | ----------------^^^^^^^^^^^^^^^-
| | | |
| attempt to compute `u8::MAX + u8::MAX` which would overflow | attempt to compute `u8::MAX + u8::MAX`, which would overflow
| |
= note: `#[deny(const_err)]` on by default = note: `#[deny(const_err)]` on by default

View file

@ -2,7 +2,7 @@ warning: this arithmetic operation will overflow
--> $DIR/promoted_errors.rs:12:20 --> $DIR/promoted_errors.rs:12:20
| |
LL | println!("{}", 0u32 - 1); LL | println!("{}", 0u32 - 1);
| ^^^^^^^^ attempt to compute `0_u32 - 1_u32` which would overflow | ^^^^^^^^ attempt to compute `0_u32 - 1_u32`, which would overflow
| |
note: the lint level is defined here note: the lint level is defined here
--> $DIR/promoted_errors.rs:9:20 --> $DIR/promoted_errors.rs:9:20
@ -14,13 +14,13 @@ warning: this arithmetic operation will overflow
--> $DIR/promoted_errors.rs:14:14 --> $DIR/promoted_errors.rs:14:14
| |
LL | let _x = 0u32 - 1; LL | let _x = 0u32 - 1;
| ^^^^^^^^ attempt to compute `0_u32 - 1_u32` which would overflow | ^^^^^^^^ attempt to compute `0_u32 - 1_u32`, which would overflow
warning: this operation will panic at runtime warning: this operation will panic at runtime
--> $DIR/promoted_errors.rs:16:20 --> $DIR/promoted_errors.rs:16:20
| |
LL | println!("{}", 1 / (1 - 1)); LL | println!("{}", 1 / (1 - 1));
| ^^^^^^^^^^^ attempt to divide 1_i32 by zero | ^^^^^^^^^^^ attempt to divide `1_i32` by zero
| |
note: the lint level is defined here note: the lint level is defined here
--> $DIR/promoted_errors.rs:9:41 --> $DIR/promoted_errors.rs:9:41
@ -50,13 +50,13 @@ warning: this operation will panic at runtime
--> $DIR/promoted_errors.rs:20:14 --> $DIR/promoted_errors.rs:20:14
| |
LL | let _x = 1 / (1 - 1); LL | let _x = 1 / (1 - 1);
| ^^^^^^^^^^^ attempt to divide 1_i32 by zero | ^^^^^^^^^^^ attempt to divide `1_i32` by zero
warning: this operation will panic at runtime warning: this operation will panic at runtime
--> $DIR/promoted_errors.rs:22:20 --> $DIR/promoted_errors.rs:22:20
| |
LL | println!("{}", 1 / (false as u32)); LL | println!("{}", 1 / (false as u32));
| ^^^^^^^^^^^^^^^^^^ attempt to divide 1_u32 by zero | ^^^^^^^^^^^^^^^^^^ attempt to divide `1_u32` by zero
warning: reaching this expression at runtime will panic or abort warning: reaching this expression at runtime will panic or abort
--> $DIR/promoted_errors.rs:22:20 --> $DIR/promoted_errors.rs:22:20
@ -74,7 +74,7 @@ warning: this operation will panic at runtime
--> $DIR/promoted_errors.rs:26:14 --> $DIR/promoted_errors.rs:26:14
| |
LL | let _x = 1 / (false as u32); LL | let _x = 1 / (false as u32);
| ^^^^^^^^^^^^^^^^^^ attempt to divide 1_u32 by zero | ^^^^^^^^^^^^^^^^^^ attempt to divide `1_u32` by zero
warning: 10 warnings emitted warning: 10 warnings emitted

View file

@ -2,7 +2,7 @@ warning: this arithmetic operation will overflow
--> $DIR/promoted_errors.rs:14:14 --> $DIR/promoted_errors.rs:14:14
| |
LL | let _x = 0u32 - 1; LL | let _x = 0u32 - 1;
| ^^^^^^^^ attempt to compute `0_u32 - 1_u32` which would overflow | ^^^^^^^^ attempt to compute `0_u32 - 1_u32`, which would overflow
| |
note: the lint level is defined here note: the lint level is defined here
--> $DIR/promoted_errors.rs:9:20 --> $DIR/promoted_errors.rs:9:20
@ -14,7 +14,7 @@ warning: this operation will panic at runtime
--> $DIR/promoted_errors.rs:16:20 --> $DIR/promoted_errors.rs:16:20
| |
LL | println!("{}", 1 / (1 - 1)); LL | println!("{}", 1 / (1 - 1));
| ^^^^^^^^^^^ attempt to divide 1_i32 by zero | ^^^^^^^^^^^ attempt to divide `1_i32` by zero
| |
note: the lint level is defined here note: the lint level is defined here
--> $DIR/promoted_errors.rs:9:41 --> $DIR/promoted_errors.rs:9:41
@ -44,13 +44,13 @@ warning: this operation will panic at runtime
--> $DIR/promoted_errors.rs:20:14 --> $DIR/promoted_errors.rs:20:14
| |
LL | let _x = 1 / (1 - 1); LL | let _x = 1 / (1 - 1);
| ^^^^^^^^^^^ attempt to divide 1_i32 by zero | ^^^^^^^^^^^ attempt to divide `1_i32` by zero
warning: this operation will panic at runtime warning: this operation will panic at runtime
--> $DIR/promoted_errors.rs:22:20 --> $DIR/promoted_errors.rs:22:20
| |
LL | println!("{}", 1 / (false as u32)); LL | println!("{}", 1 / (false as u32));
| ^^^^^^^^^^^^^^^^^^ attempt to divide 1_u32 by zero | ^^^^^^^^^^^^^^^^^^ attempt to divide `1_u32` by zero
warning: reaching this expression at runtime will panic or abort warning: reaching this expression at runtime will panic or abort
--> $DIR/promoted_errors.rs:22:20 --> $DIR/promoted_errors.rs:22:20
@ -68,7 +68,7 @@ warning: this operation will panic at runtime
--> $DIR/promoted_errors.rs:26:14 --> $DIR/promoted_errors.rs:26:14
| |
LL | let _x = 1 / (false as u32); LL | let _x = 1 / (false as u32);
| ^^^^^^^^^^^^^^^^^^ attempt to divide 1_u32 by zero | ^^^^^^^^^^^^^^^^^^ attempt to divide `1_u32` by zero
warning: 9 warnings emitted warning: 9 warnings emitted

View file

@ -2,7 +2,7 @@ warning: this arithmetic operation will overflow
--> $DIR/promoted_errors.rs:12:20 --> $DIR/promoted_errors.rs:12:20
| |
LL | println!("{}", 0u32 - 1); LL | println!("{}", 0u32 - 1);
| ^^^^^^^^ attempt to compute `0_u32 - 1_u32` which would overflow | ^^^^^^^^ attempt to compute `0_u32 - 1_u32`, which would overflow
| |
note: the lint level is defined here note: the lint level is defined here
--> $DIR/promoted_errors.rs:9:20 --> $DIR/promoted_errors.rs:9:20
@ -14,13 +14,13 @@ warning: this arithmetic operation will overflow
--> $DIR/promoted_errors.rs:14:14 --> $DIR/promoted_errors.rs:14:14
| |
LL | let _x = 0u32 - 1; LL | let _x = 0u32 - 1;
| ^^^^^^^^ attempt to compute `0_u32 - 1_u32` which would overflow | ^^^^^^^^ attempt to compute `0_u32 - 1_u32`, which would overflow
warning: this operation will panic at runtime warning: this operation will panic at runtime
--> $DIR/promoted_errors.rs:16:20 --> $DIR/promoted_errors.rs:16:20
| |
LL | println!("{}", 1 / (1 - 1)); LL | println!("{}", 1 / (1 - 1));
| ^^^^^^^^^^^ attempt to divide 1_i32 by zero | ^^^^^^^^^^^ attempt to divide `1_i32` by zero
| |
note: the lint level is defined here note: the lint level is defined here
--> $DIR/promoted_errors.rs:9:41 --> $DIR/promoted_errors.rs:9:41
@ -50,13 +50,13 @@ warning: this operation will panic at runtime
--> $DIR/promoted_errors.rs:20:14 --> $DIR/promoted_errors.rs:20:14
| |
LL | let _x = 1 / (1 - 1); LL | let _x = 1 / (1 - 1);
| ^^^^^^^^^^^ attempt to divide 1_i32 by zero | ^^^^^^^^^^^ attempt to divide `1_i32` by zero
warning: this operation will panic at runtime warning: this operation will panic at runtime
--> $DIR/promoted_errors.rs:22:20 --> $DIR/promoted_errors.rs:22:20
| |
LL | println!("{}", 1 / (false as u32)); LL | println!("{}", 1 / (false as u32));
| ^^^^^^^^^^^^^^^^^^ attempt to divide 1_u32 by zero | ^^^^^^^^^^^^^^^^^^ attempt to divide `1_u32` by zero
warning: reaching this expression at runtime will panic or abort warning: reaching this expression at runtime will panic or abort
--> $DIR/promoted_errors.rs:22:20 --> $DIR/promoted_errors.rs:22:20
@ -74,7 +74,7 @@ warning: this operation will panic at runtime
--> $DIR/promoted_errors.rs:26:14 --> $DIR/promoted_errors.rs:26:14
| |
LL | let _x = 1 / (false as u32); LL | let _x = 1 / (false as u32);
| ^^^^^^^^^^^^^^^^^^ attempt to divide 1_u32 by zero | ^^^^^^^^^^^^^^^^^^ attempt to divide `1_u32` by zero
warning: 10 warnings emitted warning: 10 warnings emitted

View file

@ -4,7 +4,7 @@ warning: any use of this value will cause an error
LL | pub const Z: u32 = 0 - 1; LL | pub const Z: u32 = 0 - 1;
| -------------------^^^^^- | -------------------^^^^^-
| | | |
| attempt to compute `0_u32 - 1_u32` which would overflow | attempt to compute `0_u32 - 1_u32`, which would overflow
| |
note: the lint level is defined here note: the lint level is defined here
--> $DIR/pub_const_err.rs:2:9 --> $DIR/pub_const_err.rs:2:9

View file

@ -4,7 +4,7 @@ warning: any use of this value will cause an error
LL | pub const Z: u32 = 0 - 1; LL | pub const Z: u32 = 0 - 1;
| -------------------^^^^^- | -------------------^^^^^-
| | | |
| attempt to compute `0_u32 - 1_u32` which would overflow | attempt to compute `0_u32 - 1_u32`, which would overflow
| |
note: the lint level is defined here note: the lint level is defined here
--> $DIR/pub_const_err_bin.rs:2:9 --> $DIR/pub_const_err_bin.rs:2:9

View file

@ -2,7 +2,7 @@ error[E0080]: evaluation of constant value failed
--> $DIR/shift_overflow.rs:3:9 --> $DIR/shift_overflow.rs:3:9
| |
LL | X = 1 << ((u32::MAX as u64) + 1), LL | X = 1 << ((u32::MAX as u64) + 1),
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ attempt to shift left by 4294967296_u64 which would overflow | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ attempt to shift left by `4294967296_u64`, which would overflow
error: aborting due to previous error error: aborting due to previous error

View file

@ -4,7 +4,7 @@ error: any use of this value will cause an error
LL | const FOO: i32 = [][0]; LL | const FOO: i32 = [][0];
| -----------------^^^^^- | -----------------^^^^^-
| | | |
| index out of bounds: the len is 0 but the index is 0 | index out of bounds: the length is 0 but the index is 0
| |
= note: `#[deny(const_err)]` on by default = note: `#[deny(const_err)]` on by default

View file

@ -2,7 +2,7 @@ error: any use of this value will cause an error
--> $DIR/const-external-macro-const-err.rs:12:5 --> $DIR/const-external-macro-const-err.rs:12:5
| |
LL | static_assert!(2 + 2 == 5); LL | static_assert!(2 + 2 == 5);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ index out of bounds: the len is 1 but the index is 1 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ index out of bounds: the length is 1 but the index is 1
| |
= note: `#[deny(const_err)]` on by default = note: `#[deny(const_err)]` on by default
= note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info) = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)

View file

@ -4,7 +4,7 @@ error: any use of this value will cause an error
LL | const LEN: usize = ONE - TWO; LL | const LEN: usize = ONE - TWO;
| -------------------^^^^^^^^^- | -------------------^^^^^^^^^-
| | | |
| attempt to compute `1_usize - 2_usize` which would overflow | attempt to compute `1_usize - 2_usize`, which would overflow
| |
= note: `#[deny(const_err)]` on by default = note: `#[deny(const_err)]` on by default

View file

@ -7,5 +7,5 @@ const TWO: usize = 2;
fn main() { fn main() {
let a: [i8; ONE - TWO] = unimplemented!(); let a: [i8; ONE - TWO] = unimplemented!();
//~^ ERROR evaluation of constant value failed //~^ ERROR evaluation of constant value failed
//~| attempt to compute `1_usize - 2_usize` which would overflow //~| attempt to compute `1_usize - 2_usize`, which would overflow
} }

View file

@ -2,7 +2,7 @@ error[E0080]: evaluation of constant value failed
--> $DIR/const-len-underflow-subspans.rs:8:17 --> $DIR/const-len-underflow-subspans.rs:8:17
| |
LL | let a: [i8; ONE - TWO] = unimplemented!(); LL | let a: [i8; ONE - TWO] = unimplemented!();
| ^^^^^^^^^ attempt to compute `1_usize - 2_usize` which would overflow | ^^^^^^^^^ attempt to compute `1_usize - 2_usize`, which would overflow
error: aborting due to previous error error: aborting due to previous error

View file

@ -2,7 +2,7 @@ error: this operation will panic at runtime
--> $DIR/const-prop-ice.rs:4:5 --> $DIR/const-prop-ice.rs:4:5
| |
LL | [0; 3][3u64 as usize]; LL | [0; 3][3u64 as usize];
| ^^^^^^^^^^^^^^^^^^^^^ index out of bounds: the len is 3 but the index is 3 | ^^^^^^^^^^^^^^^^^^^^^ index out of bounds: the length is 3 but the index is 3
| |
= note: `#[deny(unconditional_panic)]` on by default = note: `#[deny(unconditional_panic)]` on by default

View file

@ -2,7 +2,7 @@ error: this operation will panic at runtime
--> $DIR/const-prop-ice2.rs:6:20 --> $DIR/const-prop-ice2.rs:6:20
| |
LL | println!("{}", xs[Enum::One as usize]); LL | println!("{}", xs[Enum::One as usize]);
| ^^^^^^^^^^^^^^^^^^^^^^ index out of bounds: the len is 1 but the index is 1 | ^^^^^^^^^^^^^^^^^^^^^^ index out of bounds: the length is 1 but the index is 1
| |
= note: `#[deny(unconditional_panic)]` on by default = note: `#[deny(unconditional_panic)]` on by default

View file

@ -2,7 +2,7 @@
const FOO: &'static[u32] = &[1, 2, 3]; const FOO: &'static[u32] = &[1, 2, 3];
const BAR: u32 = FOO[5]; const BAR: u32 = FOO[5];
//~^ index out of bounds: the len is 3 but the index is 5 //~^ index out of bounds: the length is 3 but the index is 5
//~| ERROR any use of this value will cause an error //~| ERROR any use of this value will cause an error
fn main() { fn main() {

View file

@ -4,7 +4,7 @@ error: any use of this value will cause an error
LL | const BAR: u32 = FOO[5]; LL | const BAR: u32 = FOO[5];
| -----------------^^^^^^- | -----------------^^^^^^-
| | | |
| index out of bounds: the len is 3 but the index is 5 | index out of bounds: the length is 3 but the index is 5
| |
= note: `#[deny(const_err)]` on by default = note: `#[deny(const_err)]` on by default

View file

@ -1,6 +1,6 @@
enum Enum { enum Enum {
X = (1 << 500), //~ ERROR E0080 X = (1 << 500), //~ ERROR E0080
//~| attempt to shift left by 500_i32 which would overflow //~| attempt to shift left by `500_i32`, which would overflow
Y = (1 / 0) //~ ERROR E0080 Y = (1 / 0) //~ ERROR E0080
} }

View file

@ -2,13 +2,13 @@ error[E0080]: evaluation of constant value failed
--> $DIR/E0080.rs:2:9 --> $DIR/E0080.rs:2:9
| |
LL | X = (1 << 500), LL | X = (1 << 500),
| ^^^^^^^^^^ attempt to shift left by 500_i32 which would overflow | ^^^^^^^^^^ attempt to shift left by `500_i32`, which would overflow
error[E0080]: evaluation of constant value failed error[E0080]: evaluation of constant value failed
--> $DIR/E0080.rs:4:9 --> $DIR/E0080.rs:4:9
| |
LL | Y = (1 / 0) LL | Y = (1 / 0)
| ^^^^^^^ attempt to divide 1_isize by zero | ^^^^^^^ attempt to divide `1_isize` by zero
error: aborting due to 2 previous errors error: aborting due to 2 previous errors

View file

@ -1,9 +1,9 @@
enum Test { enum Test {
DivZero = 1/0, DivZero = 1/0,
//~^ attempt to divide 1_isize by zero //~^ attempt to divide `1_isize` by zero
//~| ERROR evaluation of constant value failed //~| ERROR evaluation of constant value failed
RemZero = 1%0, RemZero = 1%0,
//~^ attempt to calculate the remainder of 1_isize with a divisor of zero //~^ attempt to calculate the remainder of `1_isize` with a divisor of zero
//~| ERROR evaluation of constant value failed //~| ERROR evaluation of constant value failed
} }

View file

@ -2,13 +2,13 @@ error[E0080]: evaluation of constant value failed
--> $DIR/eval-enum.rs:2:15 --> $DIR/eval-enum.rs:2:15
| |
LL | DivZero = 1/0, LL | DivZero = 1/0,
| ^^^ attempt to divide 1_isize by zero | ^^^ attempt to divide `1_isize` by zero
error[E0080]: evaluation of constant value failed error[E0080]: evaluation of constant value failed
--> $DIR/eval-enum.rs:5:15 --> $DIR/eval-enum.rs:5:15
| |
LL | RemZero = 1%0, LL | RemZero = 1%0,
| ^^^ attempt to calculate the remainder of 1_isize with a divisor of zero | ^^^ attempt to calculate the remainder of `1_isize` with a divisor of zero
error: aborting due to 2 previous errors error: aborting due to 2 previous errors

View file

@ -2,7 +2,7 @@ error: this operation will panic at runtime
--> $DIR/issue-54348.rs:5:5 --> $DIR/issue-54348.rs:5:5
| |
LL | [1][1.5 as usize]; LL | [1][1.5 as usize];
| ^^^^^^^^^^^^^^^^^ index out of bounds: the len is 1 but the index is 1 | ^^^^^^^^^^^^^^^^^ index out of bounds: the length is 1 but the index is 1
| |
= note: `#[deny(unconditional_panic)]` on by default = note: `#[deny(unconditional_panic)]` on by default
@ -10,7 +10,7 @@ error: this operation will panic at runtime
--> $DIR/issue-54348.rs:6:5 --> $DIR/issue-54348.rs:6:5
| |
LL | [1][1u64 as usize]; LL | [1][1u64 as usize];
| ^^^^^^^^^^^^^^^^^^ index out of bounds: the len is 1 but the index is 1 | ^^^^^^^^^^^^^^^^^^ index out of bounds: the length is 1 but the index is 1
error: aborting due to 2 previous errors error: aborting due to 2 previous errors

View file

@ -2,7 +2,7 @@ error: this arithmetic operation will overflow
--> $DIR/issue-8460-const.rs:14:36 --> $DIR/issue-8460-const.rs:14:36
| |
LL | assert!(thread::spawn(move|| { isize::MIN / -1; }).join().is_err()); LL | assert!(thread::spawn(move|| { isize::MIN / -1; }).join().is_err());
| ^^^^^^^^^^^^^^^ attempt to compute `isize::MIN / -1_isize` which would overflow | ^^^^^^^^^^^^^^^ attempt to compute `isize::MIN / -1_isize`, which would overflow
| |
= note: `#[deny(arithmetic_overflow)]` on by default = note: `#[deny(arithmetic_overflow)]` on by default
@ -10,37 +10,37 @@ error: this arithmetic operation will overflow
--> $DIR/issue-8460-const.rs:16:36 --> $DIR/issue-8460-const.rs:16:36
| |
LL | assert!(thread::spawn(move|| { i8::MIN / -1; }).join().is_err()); LL | assert!(thread::spawn(move|| { i8::MIN / -1; }).join().is_err());
| ^^^^^^^^^^^^ attempt to compute `i8::MIN / -1_i8` which would overflow | ^^^^^^^^^^^^ attempt to compute `i8::MIN / -1_i8`, which would overflow
error: this arithmetic operation will overflow error: this arithmetic operation will overflow
--> $DIR/issue-8460-const.rs:18:36 --> $DIR/issue-8460-const.rs:18:36
| |
LL | assert!(thread::spawn(move|| { i16::MIN / -1; }).join().is_err()); LL | assert!(thread::spawn(move|| { i16::MIN / -1; }).join().is_err());
| ^^^^^^^^^^^^^ attempt to compute `i16::MIN / -1_i16` which would overflow | ^^^^^^^^^^^^^ attempt to compute `i16::MIN / -1_i16`, which would overflow
error: this arithmetic operation will overflow error: this arithmetic operation will overflow
--> $DIR/issue-8460-const.rs:20:36 --> $DIR/issue-8460-const.rs:20:36
| |
LL | assert!(thread::spawn(move|| { i32::MIN / -1; }).join().is_err()); LL | assert!(thread::spawn(move|| { i32::MIN / -1; }).join().is_err());
| ^^^^^^^^^^^^^ attempt to compute `i32::MIN / -1_i32` which would overflow | ^^^^^^^^^^^^^ attempt to compute `i32::MIN / -1_i32`, which would overflow
error: this arithmetic operation will overflow error: this arithmetic operation will overflow
--> $DIR/issue-8460-const.rs:22:36 --> $DIR/issue-8460-const.rs:22:36
| |
LL | assert!(thread::spawn(move|| { i64::MIN / -1; }).join().is_err()); LL | assert!(thread::spawn(move|| { i64::MIN / -1; }).join().is_err());
| ^^^^^^^^^^^^^ attempt to compute `i64::MIN / -1_i64` which would overflow | ^^^^^^^^^^^^^ attempt to compute `i64::MIN / -1_i64`, which would overflow
error: this arithmetic operation will overflow error: this arithmetic operation will overflow
--> $DIR/issue-8460-const.rs:24:36 --> $DIR/issue-8460-const.rs:24:36
| |
LL | assert!(thread::spawn(move|| { i128::MIN / -1; }).join().is_err()); LL | assert!(thread::spawn(move|| { i128::MIN / -1; }).join().is_err());
| ^^^^^^^^^^^^^^ attempt to compute `i128::MIN / -1_i128` which would overflow | ^^^^^^^^^^^^^^ attempt to compute `i128::MIN / -1_i128`, which would overflow
error: this operation will panic at runtime error: this operation will panic at runtime
--> $DIR/issue-8460-const.rs:26:36 --> $DIR/issue-8460-const.rs:26:36
| |
LL | assert!(thread::spawn(move|| { 1isize / 0; }).join().is_err()); LL | assert!(thread::spawn(move|| { 1isize / 0; }).join().is_err());
| ^^^^^^^^^^ attempt to divide 1_isize by zero | ^^^^^^^^^^ attempt to divide `1_isize` by zero
| |
= note: `#[deny(unconditional_panic)]` on by default = note: `#[deny(unconditional_panic)]` on by default
@ -48,103 +48,103 @@ error: this operation will panic at runtime
--> $DIR/issue-8460-const.rs:28:36 --> $DIR/issue-8460-const.rs:28:36
| |
LL | assert!(thread::spawn(move|| { 1i8 / 0; }).join().is_err()); LL | assert!(thread::spawn(move|| { 1i8 / 0; }).join().is_err());
| ^^^^^^^ attempt to divide 1_i8 by zero | ^^^^^^^ attempt to divide `1_i8` by zero
error: this operation will panic at runtime error: this operation will panic at runtime
--> $DIR/issue-8460-const.rs:30:36 --> $DIR/issue-8460-const.rs:30:36
| |
LL | assert!(thread::spawn(move|| { 1i16 / 0; }).join().is_err()); LL | assert!(thread::spawn(move|| { 1i16 / 0; }).join().is_err());
| ^^^^^^^^ attempt to divide 1_i16 by zero | ^^^^^^^^ attempt to divide `1_i16` by zero
error: this operation will panic at runtime error: this operation will panic at runtime
--> $DIR/issue-8460-const.rs:32:36 --> $DIR/issue-8460-const.rs:32:36
| |
LL | assert!(thread::spawn(move|| { 1i32 / 0; }).join().is_err()); LL | assert!(thread::spawn(move|| { 1i32 / 0; }).join().is_err());
| ^^^^^^^^ attempt to divide 1_i32 by zero | ^^^^^^^^ attempt to divide `1_i32` by zero
error: this operation will panic at runtime error: this operation will panic at runtime
--> $DIR/issue-8460-const.rs:34:36 --> $DIR/issue-8460-const.rs:34:36
| |
LL | assert!(thread::spawn(move|| { 1i64 / 0; }).join().is_err()); LL | assert!(thread::spawn(move|| { 1i64 / 0; }).join().is_err());
| ^^^^^^^^ attempt to divide 1_i64 by zero | ^^^^^^^^ attempt to divide `1_i64` by zero
error: this operation will panic at runtime error: this operation will panic at runtime
--> $DIR/issue-8460-const.rs:36:36 --> $DIR/issue-8460-const.rs:36:36
| |
LL | assert!(thread::spawn(move|| { 1i128 / 0; }).join().is_err()); LL | assert!(thread::spawn(move|| { 1i128 / 0; }).join().is_err());
| ^^^^^^^^^ attempt to divide 1_i128 by zero | ^^^^^^^^^ attempt to divide `1_i128` by zero
error: this arithmetic operation will overflow error: this arithmetic operation will overflow
--> $DIR/issue-8460-const.rs:38:36 --> $DIR/issue-8460-const.rs:38:36
| |
LL | assert!(thread::spawn(move|| { isize::MIN % -1; }).join().is_err()); LL | assert!(thread::spawn(move|| { isize::MIN % -1; }).join().is_err());
| ^^^^^^^^^^^^^^^ attempt to compute the remainder of `isize::MIN % -1_isize` which would overflow | ^^^^^^^^^^^^^^^ attempt to compute the remainder of `isize::MIN % -1_isize`, which would overflow
error: this arithmetic operation will overflow error: this arithmetic operation will overflow
--> $DIR/issue-8460-const.rs:40:36 --> $DIR/issue-8460-const.rs:40:36
| |
LL | assert!(thread::spawn(move|| { i8::MIN % -1; }).join().is_err()); LL | assert!(thread::spawn(move|| { i8::MIN % -1; }).join().is_err());
| ^^^^^^^^^^^^ attempt to compute the remainder of `i8::MIN % -1_i8` which would overflow | ^^^^^^^^^^^^ attempt to compute the remainder of `i8::MIN % -1_i8`, which would overflow
error: this arithmetic operation will overflow error: this arithmetic operation will overflow
--> $DIR/issue-8460-const.rs:42:36 --> $DIR/issue-8460-const.rs:42:36
| |
LL | assert!(thread::spawn(move|| { i16::MIN % -1; }).join().is_err()); LL | assert!(thread::spawn(move|| { i16::MIN % -1; }).join().is_err());
| ^^^^^^^^^^^^^ attempt to compute the remainder of `i16::MIN % -1_i16` which would overflow | ^^^^^^^^^^^^^ attempt to compute the remainder of `i16::MIN % -1_i16`, which would overflow
error: this arithmetic operation will overflow error: this arithmetic operation will overflow
--> $DIR/issue-8460-const.rs:44:36 --> $DIR/issue-8460-const.rs:44:36
| |
LL | assert!(thread::spawn(move|| { i32::MIN % -1; }).join().is_err()); LL | assert!(thread::spawn(move|| { i32::MIN % -1; }).join().is_err());
| ^^^^^^^^^^^^^ attempt to compute the remainder of `i32::MIN % -1_i32` which would overflow | ^^^^^^^^^^^^^ attempt to compute the remainder of `i32::MIN % -1_i32`, which would overflow
error: this arithmetic operation will overflow error: this arithmetic operation will overflow
--> $DIR/issue-8460-const.rs:46:36 --> $DIR/issue-8460-const.rs:46:36
| |
LL | assert!(thread::spawn(move|| { i64::MIN % -1; }).join().is_err()); LL | assert!(thread::spawn(move|| { i64::MIN % -1; }).join().is_err());
| ^^^^^^^^^^^^^ attempt to compute the remainder of `i64::MIN % -1_i64` which would overflow | ^^^^^^^^^^^^^ attempt to compute the remainder of `i64::MIN % -1_i64`, which would overflow
error: this arithmetic operation will overflow error: this arithmetic operation will overflow
--> $DIR/issue-8460-const.rs:48:36 --> $DIR/issue-8460-const.rs:48:36
| |
LL | assert!(thread::spawn(move|| { i128::MIN % -1; }).join().is_err()); LL | assert!(thread::spawn(move|| { i128::MIN % -1; }).join().is_err());
| ^^^^^^^^^^^^^^ attempt to compute the remainder of `i128::MIN % -1_i128` which would overflow | ^^^^^^^^^^^^^^ attempt to compute the remainder of `i128::MIN % -1_i128`, which would overflow
error: this operation will panic at runtime error: this operation will panic at runtime
--> $DIR/issue-8460-const.rs:50:36 --> $DIR/issue-8460-const.rs:50:36
| |
LL | assert!(thread::spawn(move|| { 1isize % 0; }).join().is_err()); LL | assert!(thread::spawn(move|| { 1isize % 0; }).join().is_err());
| ^^^^^^^^^^ attempt to calculate the remainder of 1_isize with a divisor of zero | ^^^^^^^^^^ attempt to calculate the remainder of `1_isize` with a divisor of zero
error: this operation will panic at runtime error: this operation will panic at runtime
--> $DIR/issue-8460-const.rs:52:36 --> $DIR/issue-8460-const.rs:52:36
| |
LL | assert!(thread::spawn(move|| { 1i8 % 0; }).join().is_err()); LL | assert!(thread::spawn(move|| { 1i8 % 0; }).join().is_err());
| ^^^^^^^ attempt to calculate the remainder of 1_i8 with a divisor of zero | ^^^^^^^ attempt to calculate the remainder of `1_i8` with a divisor of zero
error: this operation will panic at runtime error: this operation will panic at runtime
--> $DIR/issue-8460-const.rs:54:36 --> $DIR/issue-8460-const.rs:54:36
| |
LL | assert!(thread::spawn(move|| { 1i16 % 0; }).join().is_err()); LL | assert!(thread::spawn(move|| { 1i16 % 0; }).join().is_err());
| ^^^^^^^^ attempt to calculate the remainder of 1_i16 with a divisor of zero | ^^^^^^^^ attempt to calculate the remainder of `1_i16` with a divisor of zero
error: this operation will panic at runtime error: this operation will panic at runtime
--> $DIR/issue-8460-const.rs:56:36 --> $DIR/issue-8460-const.rs:56:36
| |
LL | assert!(thread::spawn(move|| { 1i32 % 0; }).join().is_err()); LL | assert!(thread::spawn(move|| { 1i32 % 0; }).join().is_err());
| ^^^^^^^^ attempt to calculate the remainder of 1_i32 with a divisor of zero | ^^^^^^^^ attempt to calculate the remainder of `1_i32` with a divisor of zero
error: this operation will panic at runtime error: this operation will panic at runtime
--> $DIR/issue-8460-const.rs:58:36 --> $DIR/issue-8460-const.rs:58:36
| |
LL | assert!(thread::spawn(move|| { 1i64 % 0; }).join().is_err()); LL | assert!(thread::spawn(move|| { 1i64 % 0; }).join().is_err());
| ^^^^^^^^ attempt to calculate the remainder of 1_i64 with a divisor of zero | ^^^^^^^^ attempt to calculate the remainder of `1_i64` with a divisor of zero
error: this operation will panic at runtime error: this operation will panic at runtime
--> $DIR/issue-8460-const.rs:60:36 --> $DIR/issue-8460-const.rs:60:36
| |
LL | assert!(thread::spawn(move|| { 1i128 % 0; }).join().is_err()); LL | assert!(thread::spawn(move|| { 1i128 % 0; }).join().is_err());
| ^^^^^^^^^ attempt to calculate the remainder of 1_i128 with a divisor of zero | ^^^^^^^^^ attempt to calculate the remainder of `1_i128` with a divisor of zero
error: aborting due to 24 previous errors error: aborting due to 24 previous errors

View file

@ -2,7 +2,7 @@ error: this arithmetic operation will overflow
--> $DIR/issue-8460-const.rs:14:36 --> $DIR/issue-8460-const.rs:14:36
| |
LL | assert!(thread::spawn(move|| { isize::MIN / -1; }).join().is_err()); LL | assert!(thread::spawn(move|| { isize::MIN / -1; }).join().is_err());
| ^^^^^^^^^^^^^^^ attempt to compute `isize::MIN / -1_isize` which would overflow | ^^^^^^^^^^^^^^^ attempt to compute `isize::MIN / -1_isize`, which would overflow
| |
= note: `#[deny(arithmetic_overflow)]` on by default = note: `#[deny(arithmetic_overflow)]` on by default
@ -10,37 +10,37 @@ error: this arithmetic operation will overflow
--> $DIR/issue-8460-const.rs:16:36 --> $DIR/issue-8460-const.rs:16:36
| |
LL | assert!(thread::spawn(move|| { i8::MIN / -1; }).join().is_err()); LL | assert!(thread::spawn(move|| { i8::MIN / -1; }).join().is_err());
| ^^^^^^^^^^^^ attempt to compute `i8::MIN / -1_i8` which would overflow | ^^^^^^^^^^^^ attempt to compute `i8::MIN / -1_i8`, which would overflow
error: this arithmetic operation will overflow error: this arithmetic operation will overflow
--> $DIR/issue-8460-const.rs:18:36 --> $DIR/issue-8460-const.rs:18:36
| |
LL | assert!(thread::spawn(move|| { i16::MIN / -1; }).join().is_err()); LL | assert!(thread::spawn(move|| { i16::MIN / -1; }).join().is_err());
| ^^^^^^^^^^^^^ attempt to compute `i16::MIN / -1_i16` which would overflow | ^^^^^^^^^^^^^ attempt to compute `i16::MIN / -1_i16`, which would overflow
error: this arithmetic operation will overflow error: this arithmetic operation will overflow
--> $DIR/issue-8460-const.rs:20:36 --> $DIR/issue-8460-const.rs:20:36
| |
LL | assert!(thread::spawn(move|| { i32::MIN / -1; }).join().is_err()); LL | assert!(thread::spawn(move|| { i32::MIN / -1; }).join().is_err());
| ^^^^^^^^^^^^^ attempt to compute `i32::MIN / -1_i32` which would overflow | ^^^^^^^^^^^^^ attempt to compute `i32::MIN / -1_i32`, which would overflow
error: this arithmetic operation will overflow error: this arithmetic operation will overflow
--> $DIR/issue-8460-const.rs:22:36 --> $DIR/issue-8460-const.rs:22:36
| |
LL | assert!(thread::spawn(move|| { i64::MIN / -1; }).join().is_err()); LL | assert!(thread::spawn(move|| { i64::MIN / -1; }).join().is_err());
| ^^^^^^^^^^^^^ attempt to compute `i64::MIN / -1_i64` which would overflow | ^^^^^^^^^^^^^ attempt to compute `i64::MIN / -1_i64`, which would overflow
error: this arithmetic operation will overflow error: this arithmetic operation will overflow
--> $DIR/issue-8460-const.rs:24:36 --> $DIR/issue-8460-const.rs:24:36
| |
LL | assert!(thread::spawn(move|| { i128::MIN / -1; }).join().is_err()); LL | assert!(thread::spawn(move|| { i128::MIN / -1; }).join().is_err());
| ^^^^^^^^^^^^^^ attempt to compute `i128::MIN / -1_i128` which would overflow | ^^^^^^^^^^^^^^ attempt to compute `i128::MIN / -1_i128`, which would overflow
error: this operation will panic at runtime error: this operation will panic at runtime
--> $DIR/issue-8460-const.rs:26:36 --> $DIR/issue-8460-const.rs:26:36
| |
LL | assert!(thread::spawn(move|| { 1isize / 0; }).join().is_err()); LL | assert!(thread::spawn(move|| { 1isize / 0; }).join().is_err());
| ^^^^^^^^^^ attempt to divide 1_isize by zero | ^^^^^^^^^^ attempt to divide `1_isize` by zero
| |
= note: `#[deny(unconditional_panic)]` on by default = note: `#[deny(unconditional_panic)]` on by default
@ -48,103 +48,103 @@ error: this operation will panic at runtime
--> $DIR/issue-8460-const.rs:28:36 --> $DIR/issue-8460-const.rs:28:36
| |
LL | assert!(thread::spawn(move|| { 1i8 / 0; }).join().is_err()); LL | assert!(thread::spawn(move|| { 1i8 / 0; }).join().is_err());
| ^^^^^^^ attempt to divide 1_i8 by zero | ^^^^^^^ attempt to divide `1_i8` by zero
error: this operation will panic at runtime error: this operation will panic at runtime
--> $DIR/issue-8460-const.rs:30:36 --> $DIR/issue-8460-const.rs:30:36
| |
LL | assert!(thread::spawn(move|| { 1i16 / 0; }).join().is_err()); LL | assert!(thread::spawn(move|| { 1i16 / 0; }).join().is_err());
| ^^^^^^^^ attempt to divide 1_i16 by zero | ^^^^^^^^ attempt to divide `1_i16` by zero
error: this operation will panic at runtime error: this operation will panic at runtime
--> $DIR/issue-8460-const.rs:32:36 --> $DIR/issue-8460-const.rs:32:36
| |
LL | assert!(thread::spawn(move|| { 1i32 / 0; }).join().is_err()); LL | assert!(thread::spawn(move|| { 1i32 / 0; }).join().is_err());
| ^^^^^^^^ attempt to divide 1_i32 by zero | ^^^^^^^^ attempt to divide `1_i32` by zero
error: this operation will panic at runtime error: this operation will panic at runtime
--> $DIR/issue-8460-const.rs:34:36 --> $DIR/issue-8460-const.rs:34:36
| |
LL | assert!(thread::spawn(move|| { 1i64 / 0; }).join().is_err()); LL | assert!(thread::spawn(move|| { 1i64 / 0; }).join().is_err());
| ^^^^^^^^ attempt to divide 1_i64 by zero | ^^^^^^^^ attempt to divide `1_i64` by zero
error: this operation will panic at runtime error: this operation will panic at runtime
--> $DIR/issue-8460-const.rs:36:36 --> $DIR/issue-8460-const.rs:36:36
| |
LL | assert!(thread::spawn(move|| { 1i128 / 0; }).join().is_err()); LL | assert!(thread::spawn(move|| { 1i128 / 0; }).join().is_err());
| ^^^^^^^^^ attempt to divide 1_i128 by zero | ^^^^^^^^^ attempt to divide `1_i128` by zero
error: this arithmetic operation will overflow error: this arithmetic operation will overflow
--> $DIR/issue-8460-const.rs:38:36 --> $DIR/issue-8460-const.rs:38:36
| |
LL | assert!(thread::spawn(move|| { isize::MIN % -1; }).join().is_err()); LL | assert!(thread::spawn(move|| { isize::MIN % -1; }).join().is_err());
| ^^^^^^^^^^^^^^^ attempt to compute the remainder of `isize::MIN % -1_isize` which would overflow | ^^^^^^^^^^^^^^^ attempt to compute the remainder of `isize::MIN % -1_isize`, which would overflow
error: this arithmetic operation will overflow error: this arithmetic operation will overflow
--> $DIR/issue-8460-const.rs:40:36 --> $DIR/issue-8460-const.rs:40:36
| |
LL | assert!(thread::spawn(move|| { i8::MIN % -1; }).join().is_err()); LL | assert!(thread::spawn(move|| { i8::MIN % -1; }).join().is_err());
| ^^^^^^^^^^^^ attempt to compute the remainder of `i8::MIN % -1_i8` which would overflow | ^^^^^^^^^^^^ attempt to compute the remainder of `i8::MIN % -1_i8`, which would overflow
error: this arithmetic operation will overflow error: this arithmetic operation will overflow
--> $DIR/issue-8460-const.rs:42:36 --> $DIR/issue-8460-const.rs:42:36
| |
LL | assert!(thread::spawn(move|| { i16::MIN % -1; }).join().is_err()); LL | assert!(thread::spawn(move|| { i16::MIN % -1; }).join().is_err());
| ^^^^^^^^^^^^^ attempt to compute the remainder of `i16::MIN % -1_i16` which would overflow | ^^^^^^^^^^^^^ attempt to compute the remainder of `i16::MIN % -1_i16`, which would overflow
error: this arithmetic operation will overflow error: this arithmetic operation will overflow
--> $DIR/issue-8460-const.rs:44:36 --> $DIR/issue-8460-const.rs:44:36
| |
LL | assert!(thread::spawn(move|| { i32::MIN % -1; }).join().is_err()); LL | assert!(thread::spawn(move|| { i32::MIN % -1; }).join().is_err());
| ^^^^^^^^^^^^^ attempt to compute the remainder of `i32::MIN % -1_i32` which would overflow | ^^^^^^^^^^^^^ attempt to compute the remainder of `i32::MIN % -1_i32`, which would overflow
error: this arithmetic operation will overflow error: this arithmetic operation will overflow
--> $DIR/issue-8460-const.rs:46:36 --> $DIR/issue-8460-const.rs:46:36
| |
LL | assert!(thread::spawn(move|| { i64::MIN % -1; }).join().is_err()); LL | assert!(thread::spawn(move|| { i64::MIN % -1; }).join().is_err());
| ^^^^^^^^^^^^^ attempt to compute the remainder of `i64::MIN % -1_i64` which would overflow | ^^^^^^^^^^^^^ attempt to compute the remainder of `i64::MIN % -1_i64`, which would overflow
error: this arithmetic operation will overflow error: this arithmetic operation will overflow
--> $DIR/issue-8460-const.rs:48:36 --> $DIR/issue-8460-const.rs:48:36
| |
LL | assert!(thread::spawn(move|| { i128::MIN % -1; }).join().is_err()); LL | assert!(thread::spawn(move|| { i128::MIN % -1; }).join().is_err());
| ^^^^^^^^^^^^^^ attempt to compute the remainder of `i128::MIN % -1_i128` which would overflow | ^^^^^^^^^^^^^^ attempt to compute the remainder of `i128::MIN % -1_i128`, which would overflow
error: this operation will panic at runtime error: this operation will panic at runtime
--> $DIR/issue-8460-const.rs:50:36 --> $DIR/issue-8460-const.rs:50:36
| |
LL | assert!(thread::spawn(move|| { 1isize % 0; }).join().is_err()); LL | assert!(thread::spawn(move|| { 1isize % 0; }).join().is_err());
| ^^^^^^^^^^ attempt to calculate the remainder of 1_isize with a divisor of zero | ^^^^^^^^^^ attempt to calculate the remainder of `1_isize` with a divisor of zero
error: this operation will panic at runtime error: this operation will panic at runtime
--> $DIR/issue-8460-const.rs:52:36 --> $DIR/issue-8460-const.rs:52:36
| |
LL | assert!(thread::spawn(move|| { 1i8 % 0; }).join().is_err()); LL | assert!(thread::spawn(move|| { 1i8 % 0; }).join().is_err());
| ^^^^^^^ attempt to calculate the remainder of 1_i8 with a divisor of zero | ^^^^^^^ attempt to calculate the remainder of `1_i8` with a divisor of zero
error: this operation will panic at runtime error: this operation will panic at runtime
--> $DIR/issue-8460-const.rs:54:36 --> $DIR/issue-8460-const.rs:54:36
| |
LL | assert!(thread::spawn(move|| { 1i16 % 0; }).join().is_err()); LL | assert!(thread::spawn(move|| { 1i16 % 0; }).join().is_err());
| ^^^^^^^^ attempt to calculate the remainder of 1_i16 with a divisor of zero | ^^^^^^^^ attempt to calculate the remainder of `1_i16` with a divisor of zero
error: this operation will panic at runtime error: this operation will panic at runtime
--> $DIR/issue-8460-const.rs:56:36 --> $DIR/issue-8460-const.rs:56:36
| |
LL | assert!(thread::spawn(move|| { 1i32 % 0; }).join().is_err()); LL | assert!(thread::spawn(move|| { 1i32 % 0; }).join().is_err());
| ^^^^^^^^ attempt to calculate the remainder of 1_i32 with a divisor of zero | ^^^^^^^^ attempt to calculate the remainder of `1_i32` with a divisor of zero
error: this operation will panic at runtime error: this operation will panic at runtime
--> $DIR/issue-8460-const.rs:58:36 --> $DIR/issue-8460-const.rs:58:36
| |
LL | assert!(thread::spawn(move|| { 1i64 % 0; }).join().is_err()); LL | assert!(thread::spawn(move|| { 1i64 % 0; }).join().is_err());
| ^^^^^^^^ attempt to calculate the remainder of 1_i64 with a divisor of zero | ^^^^^^^^ attempt to calculate the remainder of `1_i64` with a divisor of zero
error: this operation will panic at runtime error: this operation will panic at runtime
--> $DIR/issue-8460-const.rs:60:36 --> $DIR/issue-8460-const.rs:60:36
| |
LL | assert!(thread::spawn(move|| { 1i128 % 0; }).join().is_err()); LL | assert!(thread::spawn(move|| { 1i128 % 0; }).join().is_err());
| ^^^^^^^^^ attempt to calculate the remainder of 1_i128 with a divisor of zero | ^^^^^^^^^ attempt to calculate the remainder of `1_i128` with a divisor of zero
error: aborting due to 24 previous errors error: aborting due to 24 previous errors

View file

@ -2,7 +2,7 @@ error: this arithmetic operation will overflow
--> $DIR/issue-8460-const.rs:14:36 --> $DIR/issue-8460-const.rs:14:36
| |
LL | assert!(thread::spawn(move|| { isize::MIN / -1; }).join().is_err()); LL | assert!(thread::spawn(move|| { isize::MIN / -1; }).join().is_err());
| ^^^^^^^^^^^^^^^ attempt to compute `isize::MIN / -1_isize` which would overflow | ^^^^^^^^^^^^^^^ attempt to compute `isize::MIN / -1_isize`, which would overflow
| |
= note: `#[deny(arithmetic_overflow)]` on by default = note: `#[deny(arithmetic_overflow)]` on by default
@ -10,37 +10,37 @@ error: this arithmetic operation will overflow
--> $DIR/issue-8460-const.rs:16:36 --> $DIR/issue-8460-const.rs:16:36
| |
LL | assert!(thread::spawn(move|| { i8::MIN / -1; }).join().is_err()); LL | assert!(thread::spawn(move|| { i8::MIN / -1; }).join().is_err());
| ^^^^^^^^^^^^ attempt to compute `i8::MIN / -1_i8` which would overflow | ^^^^^^^^^^^^ attempt to compute `i8::MIN / -1_i8`, which would overflow
error: this arithmetic operation will overflow error: this arithmetic operation will overflow
--> $DIR/issue-8460-const.rs:18:36 --> $DIR/issue-8460-const.rs:18:36
| |
LL | assert!(thread::spawn(move|| { i16::MIN / -1; }).join().is_err()); LL | assert!(thread::spawn(move|| { i16::MIN / -1; }).join().is_err());
| ^^^^^^^^^^^^^ attempt to compute `i16::MIN / -1_i16` which would overflow | ^^^^^^^^^^^^^ attempt to compute `i16::MIN / -1_i16`, which would overflow
error: this arithmetic operation will overflow error: this arithmetic operation will overflow
--> $DIR/issue-8460-const.rs:20:36 --> $DIR/issue-8460-const.rs:20:36
| |
LL | assert!(thread::spawn(move|| { i32::MIN / -1; }).join().is_err()); LL | assert!(thread::spawn(move|| { i32::MIN / -1; }).join().is_err());
| ^^^^^^^^^^^^^ attempt to compute `i32::MIN / -1_i32` which would overflow | ^^^^^^^^^^^^^ attempt to compute `i32::MIN / -1_i32`, which would overflow
error: this arithmetic operation will overflow error: this arithmetic operation will overflow
--> $DIR/issue-8460-const.rs:22:36 --> $DIR/issue-8460-const.rs:22:36
| |
LL | assert!(thread::spawn(move|| { i64::MIN / -1; }).join().is_err()); LL | assert!(thread::spawn(move|| { i64::MIN / -1; }).join().is_err());
| ^^^^^^^^^^^^^ attempt to compute `i64::MIN / -1_i64` which would overflow | ^^^^^^^^^^^^^ attempt to compute `i64::MIN / -1_i64`, which would overflow
error: this arithmetic operation will overflow error: this arithmetic operation will overflow
--> $DIR/issue-8460-const.rs:24:36 --> $DIR/issue-8460-const.rs:24:36
| |
LL | assert!(thread::spawn(move|| { i128::MIN / -1; }).join().is_err()); LL | assert!(thread::spawn(move|| { i128::MIN / -1; }).join().is_err());
| ^^^^^^^^^^^^^^ attempt to compute `i128::MIN / -1_i128` which would overflow | ^^^^^^^^^^^^^^ attempt to compute `i128::MIN / -1_i128`, which would overflow
error: this operation will panic at runtime error: this operation will panic at runtime
--> $DIR/issue-8460-const.rs:26:36 --> $DIR/issue-8460-const.rs:26:36
| |
LL | assert!(thread::spawn(move|| { 1isize / 0; }).join().is_err()); LL | assert!(thread::spawn(move|| { 1isize / 0; }).join().is_err());
| ^^^^^^^^^^ attempt to divide 1_isize by zero | ^^^^^^^^^^ attempt to divide `1_isize` by zero
| |
= note: `#[deny(unconditional_panic)]` on by default = note: `#[deny(unconditional_panic)]` on by default
@ -48,103 +48,103 @@ error: this operation will panic at runtime
--> $DIR/issue-8460-const.rs:28:36 --> $DIR/issue-8460-const.rs:28:36
| |
LL | assert!(thread::spawn(move|| { 1i8 / 0; }).join().is_err()); LL | assert!(thread::spawn(move|| { 1i8 / 0; }).join().is_err());
| ^^^^^^^ attempt to divide 1_i8 by zero | ^^^^^^^ attempt to divide `1_i8` by zero
error: this operation will panic at runtime error: this operation will panic at runtime
--> $DIR/issue-8460-const.rs:30:36 --> $DIR/issue-8460-const.rs:30:36
| |
LL | assert!(thread::spawn(move|| { 1i16 / 0; }).join().is_err()); LL | assert!(thread::spawn(move|| { 1i16 / 0; }).join().is_err());
| ^^^^^^^^ attempt to divide 1_i16 by zero | ^^^^^^^^ attempt to divide `1_i16` by zero
error: this operation will panic at runtime error: this operation will panic at runtime
--> $DIR/issue-8460-const.rs:32:36 --> $DIR/issue-8460-const.rs:32:36
| |
LL | assert!(thread::spawn(move|| { 1i32 / 0; }).join().is_err()); LL | assert!(thread::spawn(move|| { 1i32 / 0; }).join().is_err());
| ^^^^^^^^ attempt to divide 1_i32 by zero | ^^^^^^^^ attempt to divide `1_i32` by zero
error: this operation will panic at runtime error: this operation will panic at runtime
--> $DIR/issue-8460-const.rs:34:36 --> $DIR/issue-8460-const.rs:34:36
| |
LL | assert!(thread::spawn(move|| { 1i64 / 0; }).join().is_err()); LL | assert!(thread::spawn(move|| { 1i64 / 0; }).join().is_err());
| ^^^^^^^^ attempt to divide 1_i64 by zero | ^^^^^^^^ attempt to divide `1_i64` by zero
error: this operation will panic at runtime error: this operation will panic at runtime
--> $DIR/issue-8460-const.rs:36:36 --> $DIR/issue-8460-const.rs:36:36
| |
LL | assert!(thread::spawn(move|| { 1i128 / 0; }).join().is_err()); LL | assert!(thread::spawn(move|| { 1i128 / 0; }).join().is_err());
| ^^^^^^^^^ attempt to divide 1_i128 by zero | ^^^^^^^^^ attempt to divide `1_i128` by zero
error: this arithmetic operation will overflow error: this arithmetic operation will overflow
--> $DIR/issue-8460-const.rs:38:36 --> $DIR/issue-8460-const.rs:38:36
| |
LL | assert!(thread::spawn(move|| { isize::MIN % -1; }).join().is_err()); LL | assert!(thread::spawn(move|| { isize::MIN % -1; }).join().is_err());
| ^^^^^^^^^^^^^^^ attempt to compute the remainder of `isize::MIN % -1_isize` which would overflow | ^^^^^^^^^^^^^^^ attempt to compute the remainder of `isize::MIN % -1_isize`, which would overflow
error: this arithmetic operation will overflow error: this arithmetic operation will overflow
--> $DIR/issue-8460-const.rs:40:36 --> $DIR/issue-8460-const.rs:40:36
| |
LL | assert!(thread::spawn(move|| { i8::MIN % -1; }).join().is_err()); LL | assert!(thread::spawn(move|| { i8::MIN % -1; }).join().is_err());
| ^^^^^^^^^^^^ attempt to compute the remainder of `i8::MIN % -1_i8` which would overflow | ^^^^^^^^^^^^ attempt to compute the remainder of `i8::MIN % -1_i8`, which would overflow
error: this arithmetic operation will overflow error: this arithmetic operation will overflow
--> $DIR/issue-8460-const.rs:42:36 --> $DIR/issue-8460-const.rs:42:36
| |
LL | assert!(thread::spawn(move|| { i16::MIN % -1; }).join().is_err()); LL | assert!(thread::spawn(move|| { i16::MIN % -1; }).join().is_err());
| ^^^^^^^^^^^^^ attempt to compute the remainder of `i16::MIN % -1_i16` which would overflow | ^^^^^^^^^^^^^ attempt to compute the remainder of `i16::MIN % -1_i16`, which would overflow
error: this arithmetic operation will overflow error: this arithmetic operation will overflow
--> $DIR/issue-8460-const.rs:44:36 --> $DIR/issue-8460-const.rs:44:36
| |
LL | assert!(thread::spawn(move|| { i32::MIN % -1; }).join().is_err()); LL | assert!(thread::spawn(move|| { i32::MIN % -1; }).join().is_err());
| ^^^^^^^^^^^^^ attempt to compute the remainder of `i32::MIN % -1_i32` which would overflow | ^^^^^^^^^^^^^ attempt to compute the remainder of `i32::MIN % -1_i32`, which would overflow
error: this arithmetic operation will overflow error: this arithmetic operation will overflow
--> $DIR/issue-8460-const.rs:46:36 --> $DIR/issue-8460-const.rs:46:36
| |
LL | assert!(thread::spawn(move|| { i64::MIN % -1; }).join().is_err()); LL | assert!(thread::spawn(move|| { i64::MIN % -1; }).join().is_err());
| ^^^^^^^^^^^^^ attempt to compute the remainder of `i64::MIN % -1_i64` which would overflow | ^^^^^^^^^^^^^ attempt to compute the remainder of `i64::MIN % -1_i64`, which would overflow
error: this arithmetic operation will overflow error: this arithmetic operation will overflow
--> $DIR/issue-8460-const.rs:48:36 --> $DIR/issue-8460-const.rs:48:36
| |
LL | assert!(thread::spawn(move|| { i128::MIN % -1; }).join().is_err()); LL | assert!(thread::spawn(move|| { i128::MIN % -1; }).join().is_err());
| ^^^^^^^^^^^^^^ attempt to compute the remainder of `i128::MIN % -1_i128` which would overflow | ^^^^^^^^^^^^^^ attempt to compute the remainder of `i128::MIN % -1_i128`, which would overflow
error: this operation will panic at runtime error: this operation will panic at runtime
--> $DIR/issue-8460-const.rs:50:36 --> $DIR/issue-8460-const.rs:50:36
| |
LL | assert!(thread::spawn(move|| { 1isize % 0; }).join().is_err()); LL | assert!(thread::spawn(move|| { 1isize % 0; }).join().is_err());
| ^^^^^^^^^^ attempt to calculate the remainder of 1_isize with a divisor of zero | ^^^^^^^^^^ attempt to calculate the remainder of `1_isize` with a divisor of zero
error: this operation will panic at runtime error: this operation will panic at runtime
--> $DIR/issue-8460-const.rs:52:36 --> $DIR/issue-8460-const.rs:52:36
| |
LL | assert!(thread::spawn(move|| { 1i8 % 0; }).join().is_err()); LL | assert!(thread::spawn(move|| { 1i8 % 0; }).join().is_err());
| ^^^^^^^ attempt to calculate the remainder of 1_i8 with a divisor of zero | ^^^^^^^ attempt to calculate the remainder of `1_i8` with a divisor of zero
error: this operation will panic at runtime error: this operation will panic at runtime
--> $DIR/issue-8460-const.rs:54:36 --> $DIR/issue-8460-const.rs:54:36
| |
LL | assert!(thread::spawn(move|| { 1i16 % 0; }).join().is_err()); LL | assert!(thread::spawn(move|| { 1i16 % 0; }).join().is_err());
| ^^^^^^^^ attempt to calculate the remainder of 1_i16 with a divisor of zero | ^^^^^^^^ attempt to calculate the remainder of `1_i16` with a divisor of zero
error: this operation will panic at runtime error: this operation will panic at runtime
--> $DIR/issue-8460-const.rs:56:36 --> $DIR/issue-8460-const.rs:56:36
| |
LL | assert!(thread::spawn(move|| { 1i32 % 0; }).join().is_err()); LL | assert!(thread::spawn(move|| { 1i32 % 0; }).join().is_err());
| ^^^^^^^^ attempt to calculate the remainder of 1_i32 with a divisor of zero | ^^^^^^^^ attempt to calculate the remainder of `1_i32` with a divisor of zero
error: this operation will panic at runtime error: this operation will panic at runtime
--> $DIR/issue-8460-const.rs:58:36 --> $DIR/issue-8460-const.rs:58:36
| |
LL | assert!(thread::spawn(move|| { 1i64 % 0; }).join().is_err()); LL | assert!(thread::spawn(move|| { 1i64 % 0; }).join().is_err());
| ^^^^^^^^ attempt to calculate the remainder of 1_i64 with a divisor of zero | ^^^^^^^^ attempt to calculate the remainder of `1_i64` with a divisor of zero
error: this operation will panic at runtime error: this operation will panic at runtime
--> $DIR/issue-8460-const.rs:60:36 --> $DIR/issue-8460-const.rs:60:36
| |
LL | assert!(thread::spawn(move|| { 1i128 % 0; }).join().is_err()); LL | assert!(thread::spawn(move|| { 1i128 % 0; }).join().is_err());
| ^^^^^^^^^ attempt to calculate the remainder of 1_i128 with a divisor of zero | ^^^^^^^^^ attempt to calculate the remainder of `1_i128` with a divisor of zero
error: aborting due to 24 previous errors error: aborting due to 24 previous errors

View file

@ -2,7 +2,7 @@ warning: this arithmetic operation will overflow
--> $DIR/lint-exceeding-bitshifts.rs:18:20 --> $DIR/lint-exceeding-bitshifts.rs:18:20
| |
LL | const N: i32 = T::N << 42; LL | const N: i32 = T::N << 42;
| ^^^^^^^^^^ attempt to shift left by 42_i32 which would overflow | ^^^^^^^^^^ attempt to shift left by `42_i32`, which would overflow
| |
note: the lint level is defined here note: the lint level is defined here
--> $DIR/lint-exceeding-bitshifts.rs:10:9 --> $DIR/lint-exceeding-bitshifts.rs:10:9
@ -14,139 +14,139 @@ warning: this arithmetic operation will overflow
--> $DIR/lint-exceeding-bitshifts.rs:22:13 --> $DIR/lint-exceeding-bitshifts.rs:22:13
| |
LL | let _ = x << 42; LL | let _ = x << 42;
| ^^^^^^^ attempt to shift left by 42_i32 which would overflow | ^^^^^^^ attempt to shift left by `42_i32`, which would overflow
warning: this arithmetic operation will overflow warning: this arithmetic operation will overflow
--> $DIR/lint-exceeding-bitshifts.rs:27:15 --> $DIR/lint-exceeding-bitshifts.rs:27:15
| |
LL | let n = 1u8 << 8; LL | let n = 1u8 << 8;
| ^^^^^^^^ attempt to shift left by 8_i32 which would overflow | ^^^^^^^^ attempt to shift left by `8_i32`, which would overflow
warning: this arithmetic operation will overflow warning: this arithmetic operation will overflow
--> $DIR/lint-exceeding-bitshifts.rs:29:15 --> $DIR/lint-exceeding-bitshifts.rs:29:15
| |
LL | let n = 1u16 << 16; LL | let n = 1u16 << 16;
| ^^^^^^^^^^ attempt to shift left by 16_i32 which would overflow | ^^^^^^^^^^ attempt to shift left by `16_i32`, which would overflow
warning: this arithmetic operation will overflow warning: this arithmetic operation will overflow
--> $DIR/lint-exceeding-bitshifts.rs:31:15 --> $DIR/lint-exceeding-bitshifts.rs:31:15
| |
LL | let n = 1u32 << 32; LL | let n = 1u32 << 32;
| ^^^^^^^^^^ attempt to shift left by 32_i32 which would overflow | ^^^^^^^^^^ attempt to shift left by `32_i32`, which would overflow
warning: this arithmetic operation will overflow warning: this arithmetic operation will overflow
--> $DIR/lint-exceeding-bitshifts.rs:33:15 --> $DIR/lint-exceeding-bitshifts.rs:33:15
| |
LL | let n = 1u64 << 64; LL | let n = 1u64 << 64;
| ^^^^^^^^^^ attempt to shift left by 64_i32 which would overflow | ^^^^^^^^^^ attempt to shift left by `64_i32`, which would overflow
warning: this arithmetic operation will overflow warning: this arithmetic operation will overflow
--> $DIR/lint-exceeding-bitshifts.rs:35:15 --> $DIR/lint-exceeding-bitshifts.rs:35:15
| |
LL | let n = 1i8 << 8; LL | let n = 1i8 << 8;
| ^^^^^^^^ attempt to shift left by 8_i32 which would overflow | ^^^^^^^^ attempt to shift left by `8_i32`, which would overflow
warning: this arithmetic operation will overflow warning: this arithmetic operation will overflow
--> $DIR/lint-exceeding-bitshifts.rs:37:15 --> $DIR/lint-exceeding-bitshifts.rs:37:15
| |
LL | let n = 1i16 << 16; LL | let n = 1i16 << 16;
| ^^^^^^^^^^ attempt to shift left by 16_i32 which would overflow | ^^^^^^^^^^ attempt to shift left by `16_i32`, which would overflow
warning: this arithmetic operation will overflow warning: this arithmetic operation will overflow
--> $DIR/lint-exceeding-bitshifts.rs:39:15 --> $DIR/lint-exceeding-bitshifts.rs:39:15
| |
LL | let n = 1i32 << 32; LL | let n = 1i32 << 32;
| ^^^^^^^^^^ attempt to shift left by 32_i32 which would overflow | ^^^^^^^^^^ attempt to shift left by `32_i32`, which would overflow
warning: this arithmetic operation will overflow warning: this arithmetic operation will overflow
--> $DIR/lint-exceeding-bitshifts.rs:41:15 --> $DIR/lint-exceeding-bitshifts.rs:41:15
| |
LL | let n = 1i64 << 64; LL | let n = 1i64 << 64;
| ^^^^^^^^^^ attempt to shift left by 64_i32 which would overflow | ^^^^^^^^^^ attempt to shift left by `64_i32`, which would overflow
warning: this arithmetic operation will overflow warning: this arithmetic operation will overflow
--> $DIR/lint-exceeding-bitshifts.rs:44:15 --> $DIR/lint-exceeding-bitshifts.rs:44:15
| |
LL | let n = 1u8 >> 8; LL | let n = 1u8 >> 8;
| ^^^^^^^^ attempt to shift right by 8_i32 which would overflow | ^^^^^^^^ attempt to shift right by `8_i32`, which would overflow
warning: this arithmetic operation will overflow warning: this arithmetic operation will overflow
--> $DIR/lint-exceeding-bitshifts.rs:46:15 --> $DIR/lint-exceeding-bitshifts.rs:46:15
| |
LL | let n = 1u16 >> 16; LL | let n = 1u16 >> 16;
| ^^^^^^^^^^ attempt to shift right by 16_i32 which would overflow | ^^^^^^^^^^ attempt to shift right by `16_i32`, which would overflow
warning: this arithmetic operation will overflow warning: this arithmetic operation will overflow
--> $DIR/lint-exceeding-bitshifts.rs:48:15 --> $DIR/lint-exceeding-bitshifts.rs:48:15
| |
LL | let n = 1u32 >> 32; LL | let n = 1u32 >> 32;
| ^^^^^^^^^^ attempt to shift right by 32_i32 which would overflow | ^^^^^^^^^^ attempt to shift right by `32_i32`, which would overflow
warning: this arithmetic operation will overflow warning: this arithmetic operation will overflow
--> $DIR/lint-exceeding-bitshifts.rs:50:15 --> $DIR/lint-exceeding-bitshifts.rs:50:15
| |
LL | let n = 1u64 >> 64; LL | let n = 1u64 >> 64;
| ^^^^^^^^^^ attempt to shift right by 64_i32 which would overflow | ^^^^^^^^^^ attempt to shift right by `64_i32`, which would overflow
warning: this arithmetic operation will overflow warning: this arithmetic operation will overflow
--> $DIR/lint-exceeding-bitshifts.rs:52:15 --> $DIR/lint-exceeding-bitshifts.rs:52:15
| |
LL | let n = 1i8 >> 8; LL | let n = 1i8 >> 8;
| ^^^^^^^^ attempt to shift right by 8_i32 which would overflow | ^^^^^^^^ attempt to shift right by `8_i32`, which would overflow
warning: this arithmetic operation will overflow warning: this arithmetic operation will overflow
--> $DIR/lint-exceeding-bitshifts.rs:54:15 --> $DIR/lint-exceeding-bitshifts.rs:54:15
| |
LL | let n = 1i16 >> 16; LL | let n = 1i16 >> 16;
| ^^^^^^^^^^ attempt to shift right by 16_i32 which would overflow | ^^^^^^^^^^ attempt to shift right by `16_i32`, which would overflow
warning: this arithmetic operation will overflow warning: this arithmetic operation will overflow
--> $DIR/lint-exceeding-bitshifts.rs:56:15 --> $DIR/lint-exceeding-bitshifts.rs:56:15
| |
LL | let n = 1i32 >> 32; LL | let n = 1i32 >> 32;
| ^^^^^^^^^^ attempt to shift right by 32_i32 which would overflow | ^^^^^^^^^^ attempt to shift right by `32_i32`, which would overflow
warning: this arithmetic operation will overflow warning: this arithmetic operation will overflow
--> $DIR/lint-exceeding-bitshifts.rs:58:15 --> $DIR/lint-exceeding-bitshifts.rs:58:15
| |
LL | let n = 1i64 >> 64; LL | let n = 1i64 >> 64;
| ^^^^^^^^^^ attempt to shift right by 64_i32 which would overflow | ^^^^^^^^^^ attempt to shift right by `64_i32`, which would overflow
warning: this arithmetic operation will overflow warning: this arithmetic operation will overflow
--> $DIR/lint-exceeding-bitshifts.rs:62:15 --> $DIR/lint-exceeding-bitshifts.rs:62:15
| |
LL | let n = n << 8; LL | let n = n << 8;
| ^^^^^^ attempt to shift left by 8_i32 which would overflow | ^^^^^^ attempt to shift left by `8_i32`, which would overflow
warning: this arithmetic operation will overflow warning: this arithmetic operation will overflow
--> $DIR/lint-exceeding-bitshifts.rs:64:15 --> $DIR/lint-exceeding-bitshifts.rs:64:15
| |
LL | let n = 1u8 << -8; LL | let n = 1u8 << -8;
| ^^^^^^^^^ attempt to shift left by -8_i32 which would overflow | ^^^^^^^^^ attempt to shift left by `-8_i32`, which would overflow
warning: this arithmetic operation will overflow warning: this arithmetic operation will overflow
--> $DIR/lint-exceeding-bitshifts.rs:69:15 --> $DIR/lint-exceeding-bitshifts.rs:69:15
| |
LL | let n = 1u8 << (4+4); LL | let n = 1u8 << (4+4);
| ^^^^^^^^^^^^ attempt to shift left by 8_i32 which would overflow | ^^^^^^^^^^^^ attempt to shift left by `8_i32`, which would overflow
warning: this arithmetic operation will overflow warning: this arithmetic operation will overflow
--> $DIR/lint-exceeding-bitshifts.rs:71:15 --> $DIR/lint-exceeding-bitshifts.rs:71:15
| |
LL | let n = 1i64 >> [64][0]; LL | let n = 1i64 >> [64][0];
| ^^^^^^^^^^^^^^^ attempt to shift right by 64_i32 which would overflow | ^^^^^^^^^^^^^^^ attempt to shift right by `64_i32`, which would overflow
warning: this arithmetic operation will overflow warning: this arithmetic operation will overflow
--> $DIR/lint-exceeding-bitshifts.rs:77:15 --> $DIR/lint-exceeding-bitshifts.rs:77:15
| |
LL | let n = 1_isize << BITS; LL | let n = 1_isize << BITS;
| ^^^^^^^^^^^^^^^ attempt to shift left by %BITS% which would overflow | ^^^^^^^^^^^^^^^ attempt to shift left by `64_usize`, which would overflow
warning: this arithmetic operation will overflow warning: this arithmetic operation will overflow
--> $DIR/lint-exceeding-bitshifts.rs:78:15 --> $DIR/lint-exceeding-bitshifts.rs:78:15
| |
LL | let n = 1_usize << BITS; LL | let n = 1_usize << BITS;
| ^^^^^^^^^^^^^^^ attempt to shift left by %BITS% which would overflow | ^^^^^^^^^^^^^^^ attempt to shift left by `64_usize`, which would overflow
warning: 24 warnings emitted warning: 24 warnings emitted

View file

@ -2,7 +2,7 @@ warning: this arithmetic operation will overflow
--> $DIR/lint-exceeding-bitshifts.rs:18:20 --> $DIR/lint-exceeding-bitshifts.rs:18:20
| |
LL | const N: i32 = T::N << 42; LL | const N: i32 = T::N << 42;
| ^^^^^^^^^^ attempt to shift left by 42_i32 which would overflow | ^^^^^^^^^^ attempt to shift left by `42_i32`, which would overflow
| |
note: the lint level is defined here note: the lint level is defined here
--> $DIR/lint-exceeding-bitshifts.rs:10:9 --> $DIR/lint-exceeding-bitshifts.rs:10:9
@ -14,139 +14,139 @@ warning: this arithmetic operation will overflow
--> $DIR/lint-exceeding-bitshifts.rs:22:13 --> $DIR/lint-exceeding-bitshifts.rs:22:13
| |
LL | let _ = x << 42; LL | let _ = x << 42;
| ^^^^^^^ attempt to shift left by 42_i32 which would overflow | ^^^^^^^ attempt to shift left by `42_i32`, which would overflow
warning: this arithmetic operation will overflow warning: this arithmetic operation will overflow
--> $DIR/lint-exceeding-bitshifts.rs:27:15 --> $DIR/lint-exceeding-bitshifts.rs:27:15
| |
LL | let n = 1u8 << 8; LL | let n = 1u8 << 8;
| ^^^^^^^^ attempt to shift left by 8_i32 which would overflow | ^^^^^^^^ attempt to shift left by `8_i32`, which would overflow
warning: this arithmetic operation will overflow warning: this arithmetic operation will overflow
--> $DIR/lint-exceeding-bitshifts.rs:29:15 --> $DIR/lint-exceeding-bitshifts.rs:29:15
| |
LL | let n = 1u16 << 16; LL | let n = 1u16 << 16;
| ^^^^^^^^^^ attempt to shift left by 16_i32 which would overflow | ^^^^^^^^^^ attempt to shift left by `16_i32`, which would overflow
warning: this arithmetic operation will overflow warning: this arithmetic operation will overflow
--> $DIR/lint-exceeding-bitshifts.rs:31:15 --> $DIR/lint-exceeding-bitshifts.rs:31:15
| |
LL | let n = 1u32 << 32; LL | let n = 1u32 << 32;
| ^^^^^^^^^^ attempt to shift left by 32_i32 which would overflow | ^^^^^^^^^^ attempt to shift left by `32_i32`, which would overflow
warning: this arithmetic operation will overflow warning: this arithmetic operation will overflow
--> $DIR/lint-exceeding-bitshifts.rs:33:15 --> $DIR/lint-exceeding-bitshifts.rs:33:15
| |
LL | let n = 1u64 << 64; LL | let n = 1u64 << 64;
| ^^^^^^^^^^ attempt to shift left by 64_i32 which would overflow | ^^^^^^^^^^ attempt to shift left by `64_i32`, which would overflow
warning: this arithmetic operation will overflow warning: this arithmetic operation will overflow
--> $DIR/lint-exceeding-bitshifts.rs:35:15 --> $DIR/lint-exceeding-bitshifts.rs:35:15
| |
LL | let n = 1i8 << 8; LL | let n = 1i8 << 8;
| ^^^^^^^^ attempt to shift left by 8_i32 which would overflow | ^^^^^^^^ attempt to shift left by `8_i32`, which would overflow
warning: this arithmetic operation will overflow warning: this arithmetic operation will overflow
--> $DIR/lint-exceeding-bitshifts.rs:37:15 --> $DIR/lint-exceeding-bitshifts.rs:37:15
| |
LL | let n = 1i16 << 16; LL | let n = 1i16 << 16;
| ^^^^^^^^^^ attempt to shift left by 16_i32 which would overflow | ^^^^^^^^^^ attempt to shift left by `16_i32`, which would overflow
warning: this arithmetic operation will overflow warning: this arithmetic operation will overflow
--> $DIR/lint-exceeding-bitshifts.rs:39:15 --> $DIR/lint-exceeding-bitshifts.rs:39:15
| |
LL | let n = 1i32 << 32; LL | let n = 1i32 << 32;
| ^^^^^^^^^^ attempt to shift left by 32_i32 which would overflow | ^^^^^^^^^^ attempt to shift left by `32_i32`, which would overflow
warning: this arithmetic operation will overflow warning: this arithmetic operation will overflow
--> $DIR/lint-exceeding-bitshifts.rs:41:15 --> $DIR/lint-exceeding-bitshifts.rs:41:15
| |
LL | let n = 1i64 << 64; LL | let n = 1i64 << 64;
| ^^^^^^^^^^ attempt to shift left by 64_i32 which would overflow | ^^^^^^^^^^ attempt to shift left by `64_i32`, which would overflow
warning: this arithmetic operation will overflow warning: this arithmetic operation will overflow
--> $DIR/lint-exceeding-bitshifts.rs:44:15 --> $DIR/lint-exceeding-bitshifts.rs:44:15
| |
LL | let n = 1u8 >> 8; LL | let n = 1u8 >> 8;
| ^^^^^^^^ attempt to shift right by 8_i32 which would overflow | ^^^^^^^^ attempt to shift right by `8_i32`, which would overflow
warning: this arithmetic operation will overflow warning: this arithmetic operation will overflow
--> $DIR/lint-exceeding-bitshifts.rs:46:15 --> $DIR/lint-exceeding-bitshifts.rs:46:15
| |
LL | let n = 1u16 >> 16; LL | let n = 1u16 >> 16;
| ^^^^^^^^^^ attempt to shift right by 16_i32 which would overflow | ^^^^^^^^^^ attempt to shift right by `16_i32`, which would overflow
warning: this arithmetic operation will overflow warning: this arithmetic operation will overflow
--> $DIR/lint-exceeding-bitshifts.rs:48:15 --> $DIR/lint-exceeding-bitshifts.rs:48:15
| |
LL | let n = 1u32 >> 32; LL | let n = 1u32 >> 32;
| ^^^^^^^^^^ attempt to shift right by 32_i32 which would overflow | ^^^^^^^^^^ attempt to shift right by `32_i32`, which would overflow
warning: this arithmetic operation will overflow warning: this arithmetic operation will overflow
--> $DIR/lint-exceeding-bitshifts.rs:50:15 --> $DIR/lint-exceeding-bitshifts.rs:50:15
| |
LL | let n = 1u64 >> 64; LL | let n = 1u64 >> 64;
| ^^^^^^^^^^ attempt to shift right by 64_i32 which would overflow | ^^^^^^^^^^ attempt to shift right by `64_i32`, which would overflow
warning: this arithmetic operation will overflow warning: this arithmetic operation will overflow
--> $DIR/lint-exceeding-bitshifts.rs:52:15 --> $DIR/lint-exceeding-bitshifts.rs:52:15
| |
LL | let n = 1i8 >> 8; LL | let n = 1i8 >> 8;
| ^^^^^^^^ attempt to shift right by 8_i32 which would overflow | ^^^^^^^^ attempt to shift right by `8_i32`, which would overflow
warning: this arithmetic operation will overflow warning: this arithmetic operation will overflow
--> $DIR/lint-exceeding-bitshifts.rs:54:15 --> $DIR/lint-exceeding-bitshifts.rs:54:15
| |
LL | let n = 1i16 >> 16; LL | let n = 1i16 >> 16;
| ^^^^^^^^^^ attempt to shift right by 16_i32 which would overflow | ^^^^^^^^^^ attempt to shift right by `16_i32`, which would overflow
warning: this arithmetic operation will overflow warning: this arithmetic operation will overflow
--> $DIR/lint-exceeding-bitshifts.rs:56:15 --> $DIR/lint-exceeding-bitshifts.rs:56:15
| |
LL | let n = 1i32 >> 32; LL | let n = 1i32 >> 32;
| ^^^^^^^^^^ attempt to shift right by 32_i32 which would overflow | ^^^^^^^^^^ attempt to shift right by `32_i32`, which would overflow
warning: this arithmetic operation will overflow warning: this arithmetic operation will overflow
--> $DIR/lint-exceeding-bitshifts.rs:58:15 --> $DIR/lint-exceeding-bitshifts.rs:58:15
| |
LL | let n = 1i64 >> 64; LL | let n = 1i64 >> 64;
| ^^^^^^^^^^ attempt to shift right by 64_i32 which would overflow | ^^^^^^^^^^ attempt to shift right by `64_i32`, which would overflow
warning: this arithmetic operation will overflow warning: this arithmetic operation will overflow
--> $DIR/lint-exceeding-bitshifts.rs:62:15 --> $DIR/lint-exceeding-bitshifts.rs:62:15
| |
LL | let n = n << 8; LL | let n = n << 8;
| ^^^^^^ attempt to shift left by 8_i32 which would overflow | ^^^^^^ attempt to shift left by `8_i32`, which would overflow
warning: this arithmetic operation will overflow warning: this arithmetic operation will overflow
--> $DIR/lint-exceeding-bitshifts.rs:64:15 --> $DIR/lint-exceeding-bitshifts.rs:64:15
| |
LL | let n = 1u8 << -8; LL | let n = 1u8 << -8;
| ^^^^^^^^^ attempt to shift left by -8_i32 which would overflow | ^^^^^^^^^ attempt to shift left by `-8_i32`, which would overflow
warning: this arithmetic operation will overflow warning: this arithmetic operation will overflow
--> $DIR/lint-exceeding-bitshifts.rs:69:15 --> $DIR/lint-exceeding-bitshifts.rs:69:15
| |
LL | let n = 1u8 << (4+4); LL | let n = 1u8 << (4+4);
| ^^^^^^^^^^^^ attempt to shift left by 8_i32 which would overflow | ^^^^^^^^^^^^ attempt to shift left by `8_i32`, which would overflow
warning: this arithmetic operation will overflow warning: this arithmetic operation will overflow
--> $DIR/lint-exceeding-bitshifts.rs:71:15 --> $DIR/lint-exceeding-bitshifts.rs:71:15
| |
LL | let n = 1i64 >> [64][0]; LL | let n = 1i64 >> [64][0];
| ^^^^^^^^^^^^^^^ attempt to shift right by 64_i32 which would overflow | ^^^^^^^^^^^^^^^ attempt to shift right by `64_i32`, which would overflow
warning: this arithmetic operation will overflow warning: this arithmetic operation will overflow
--> $DIR/lint-exceeding-bitshifts.rs:77:15 --> $DIR/lint-exceeding-bitshifts.rs:77:15
| |
LL | let n = 1_isize << BITS; LL | let n = 1_isize << BITS;
| ^^^^^^^^^^^^^^^ attempt to shift left by %BITS% which would overflow | ^^^^^^^^^^^^^^^ attempt to shift left by `64_usize`, which would overflow
warning: this arithmetic operation will overflow warning: this arithmetic operation will overflow
--> $DIR/lint-exceeding-bitshifts.rs:78:15 --> $DIR/lint-exceeding-bitshifts.rs:78:15
| |
LL | let n = 1_usize << BITS; LL | let n = 1_usize << BITS;
| ^^^^^^^^^^^^^^^ attempt to shift left by %BITS% which would overflow | ^^^^^^^^^^^^^^^ attempt to shift left by `64_usize`, which would overflow
warning: 24 warnings emitted warning: 24 warnings emitted

View file

@ -2,7 +2,7 @@ warning: this arithmetic operation will overflow
--> $DIR/lint-exceeding-bitshifts.rs:18:20 --> $DIR/lint-exceeding-bitshifts.rs:18:20
| |
LL | const N: i32 = T::N << 42; LL | const N: i32 = T::N << 42;
| ^^^^^^^^^^ attempt to shift left by 42_i32 which would overflow | ^^^^^^^^^^ attempt to shift left by `42_i32`, which would overflow
| |
note: the lint level is defined here note: the lint level is defined here
--> $DIR/lint-exceeding-bitshifts.rs:10:9 --> $DIR/lint-exceeding-bitshifts.rs:10:9
@ -14,139 +14,139 @@ warning: this arithmetic operation will overflow
--> $DIR/lint-exceeding-bitshifts.rs:22:13 --> $DIR/lint-exceeding-bitshifts.rs:22:13
| |
LL | let _ = x << 42; LL | let _ = x << 42;
| ^^^^^^^ attempt to shift left by 42_i32 which would overflow | ^^^^^^^ attempt to shift left by `42_i32`, which would overflow
warning: this arithmetic operation will overflow warning: this arithmetic operation will overflow
--> $DIR/lint-exceeding-bitshifts.rs:27:15 --> $DIR/lint-exceeding-bitshifts.rs:27:15
| |
LL | let n = 1u8 << 8; LL | let n = 1u8 << 8;
| ^^^^^^^^ attempt to shift left by 8_i32 which would overflow | ^^^^^^^^ attempt to shift left by `8_i32`, which would overflow
warning: this arithmetic operation will overflow warning: this arithmetic operation will overflow
--> $DIR/lint-exceeding-bitshifts.rs:29:15 --> $DIR/lint-exceeding-bitshifts.rs:29:15
| |
LL | let n = 1u16 << 16; LL | let n = 1u16 << 16;
| ^^^^^^^^^^ attempt to shift left by 16_i32 which would overflow | ^^^^^^^^^^ attempt to shift left by `16_i32`, which would overflow
warning: this arithmetic operation will overflow warning: this arithmetic operation will overflow
--> $DIR/lint-exceeding-bitshifts.rs:31:15 --> $DIR/lint-exceeding-bitshifts.rs:31:15
| |
LL | let n = 1u32 << 32; LL | let n = 1u32 << 32;
| ^^^^^^^^^^ attempt to shift left by 32_i32 which would overflow | ^^^^^^^^^^ attempt to shift left by `32_i32`, which would overflow
warning: this arithmetic operation will overflow warning: this arithmetic operation will overflow
--> $DIR/lint-exceeding-bitshifts.rs:33:15 --> $DIR/lint-exceeding-bitshifts.rs:33:15
| |
LL | let n = 1u64 << 64; LL | let n = 1u64 << 64;
| ^^^^^^^^^^ attempt to shift left by 64_i32 which would overflow | ^^^^^^^^^^ attempt to shift left by `64_i32`, which would overflow
warning: this arithmetic operation will overflow warning: this arithmetic operation will overflow
--> $DIR/lint-exceeding-bitshifts.rs:35:15 --> $DIR/lint-exceeding-bitshifts.rs:35:15
| |
LL | let n = 1i8 << 8; LL | let n = 1i8 << 8;
| ^^^^^^^^ attempt to shift left by 8_i32 which would overflow | ^^^^^^^^ attempt to shift left by `8_i32`, which would overflow
warning: this arithmetic operation will overflow warning: this arithmetic operation will overflow
--> $DIR/lint-exceeding-bitshifts.rs:37:15 --> $DIR/lint-exceeding-bitshifts.rs:37:15
| |
LL | let n = 1i16 << 16; LL | let n = 1i16 << 16;
| ^^^^^^^^^^ attempt to shift left by 16_i32 which would overflow | ^^^^^^^^^^ attempt to shift left by `16_i32`, which would overflow
warning: this arithmetic operation will overflow warning: this arithmetic operation will overflow
--> $DIR/lint-exceeding-bitshifts.rs:39:15 --> $DIR/lint-exceeding-bitshifts.rs:39:15
| |
LL | let n = 1i32 << 32; LL | let n = 1i32 << 32;
| ^^^^^^^^^^ attempt to shift left by 32_i32 which would overflow | ^^^^^^^^^^ attempt to shift left by `32_i32`, which would overflow
warning: this arithmetic operation will overflow warning: this arithmetic operation will overflow
--> $DIR/lint-exceeding-bitshifts.rs:41:15 --> $DIR/lint-exceeding-bitshifts.rs:41:15
| |
LL | let n = 1i64 << 64; LL | let n = 1i64 << 64;
| ^^^^^^^^^^ attempt to shift left by 64_i32 which would overflow | ^^^^^^^^^^ attempt to shift left by `64_i32`, which would overflow
warning: this arithmetic operation will overflow warning: this arithmetic operation will overflow
--> $DIR/lint-exceeding-bitshifts.rs:44:15 --> $DIR/lint-exceeding-bitshifts.rs:44:15
| |
LL | let n = 1u8 >> 8; LL | let n = 1u8 >> 8;
| ^^^^^^^^ attempt to shift right by 8_i32 which would overflow | ^^^^^^^^ attempt to shift right by `8_i32`, which would overflow
warning: this arithmetic operation will overflow warning: this arithmetic operation will overflow
--> $DIR/lint-exceeding-bitshifts.rs:46:15 --> $DIR/lint-exceeding-bitshifts.rs:46:15
| |
LL | let n = 1u16 >> 16; LL | let n = 1u16 >> 16;
| ^^^^^^^^^^ attempt to shift right by 16_i32 which would overflow | ^^^^^^^^^^ attempt to shift right by `16_i32`, which would overflow
warning: this arithmetic operation will overflow warning: this arithmetic operation will overflow
--> $DIR/lint-exceeding-bitshifts.rs:48:15 --> $DIR/lint-exceeding-bitshifts.rs:48:15
| |
LL | let n = 1u32 >> 32; LL | let n = 1u32 >> 32;
| ^^^^^^^^^^ attempt to shift right by 32_i32 which would overflow | ^^^^^^^^^^ attempt to shift right by `32_i32`, which would overflow
warning: this arithmetic operation will overflow warning: this arithmetic operation will overflow
--> $DIR/lint-exceeding-bitshifts.rs:50:15 --> $DIR/lint-exceeding-bitshifts.rs:50:15
| |
LL | let n = 1u64 >> 64; LL | let n = 1u64 >> 64;
| ^^^^^^^^^^ attempt to shift right by 64_i32 which would overflow | ^^^^^^^^^^ attempt to shift right by `64_i32`, which would overflow
warning: this arithmetic operation will overflow warning: this arithmetic operation will overflow
--> $DIR/lint-exceeding-bitshifts.rs:52:15 --> $DIR/lint-exceeding-bitshifts.rs:52:15
| |
LL | let n = 1i8 >> 8; LL | let n = 1i8 >> 8;
| ^^^^^^^^ attempt to shift right by 8_i32 which would overflow | ^^^^^^^^ attempt to shift right by `8_i32`, which would overflow
warning: this arithmetic operation will overflow warning: this arithmetic operation will overflow
--> $DIR/lint-exceeding-bitshifts.rs:54:15 --> $DIR/lint-exceeding-bitshifts.rs:54:15
| |
LL | let n = 1i16 >> 16; LL | let n = 1i16 >> 16;
| ^^^^^^^^^^ attempt to shift right by 16_i32 which would overflow | ^^^^^^^^^^ attempt to shift right by `16_i32`, which would overflow
warning: this arithmetic operation will overflow warning: this arithmetic operation will overflow
--> $DIR/lint-exceeding-bitshifts.rs:56:15 --> $DIR/lint-exceeding-bitshifts.rs:56:15
| |
LL | let n = 1i32 >> 32; LL | let n = 1i32 >> 32;
| ^^^^^^^^^^ attempt to shift right by 32_i32 which would overflow | ^^^^^^^^^^ attempt to shift right by `32_i32`, which would overflow
warning: this arithmetic operation will overflow warning: this arithmetic operation will overflow
--> $DIR/lint-exceeding-bitshifts.rs:58:15 --> $DIR/lint-exceeding-bitshifts.rs:58:15
| |
LL | let n = 1i64 >> 64; LL | let n = 1i64 >> 64;
| ^^^^^^^^^^ attempt to shift right by 64_i32 which would overflow | ^^^^^^^^^^ attempt to shift right by `64_i32`, which would overflow
warning: this arithmetic operation will overflow warning: this arithmetic operation will overflow
--> $DIR/lint-exceeding-bitshifts.rs:62:15 --> $DIR/lint-exceeding-bitshifts.rs:62:15
| |
LL | let n = n << 8; LL | let n = n << 8;
| ^^^^^^ attempt to shift left by 8_i32 which would overflow | ^^^^^^ attempt to shift left by `8_i32`, which would overflow
warning: this arithmetic operation will overflow warning: this arithmetic operation will overflow
--> $DIR/lint-exceeding-bitshifts.rs:64:15 --> $DIR/lint-exceeding-bitshifts.rs:64:15
| |
LL | let n = 1u8 << -8; LL | let n = 1u8 << -8;
| ^^^^^^^^^ attempt to shift left by -8_i32 which would overflow | ^^^^^^^^^ attempt to shift left by `-8_i32`, which would overflow
warning: this arithmetic operation will overflow warning: this arithmetic operation will overflow
--> $DIR/lint-exceeding-bitshifts.rs:69:15 --> $DIR/lint-exceeding-bitshifts.rs:69:15
| |
LL | let n = 1u8 << (4+4); LL | let n = 1u8 << (4+4);
| ^^^^^^^^^^^^ attempt to shift left by 8_i32 which would overflow | ^^^^^^^^^^^^ attempt to shift left by `8_i32`, which would overflow
warning: this arithmetic operation will overflow warning: this arithmetic operation will overflow
--> $DIR/lint-exceeding-bitshifts.rs:71:15 --> $DIR/lint-exceeding-bitshifts.rs:71:15
| |
LL | let n = 1i64 >> [64][0]; LL | let n = 1i64 >> [64][0];
| ^^^^^^^^^^^^^^^ attempt to shift right by 64_i32 which would overflow | ^^^^^^^^^^^^^^^ attempt to shift right by `64_i32`, which would overflow
warning: this arithmetic operation will overflow warning: this arithmetic operation will overflow
--> $DIR/lint-exceeding-bitshifts.rs:77:15 --> $DIR/lint-exceeding-bitshifts.rs:77:15
| |
LL | let n = 1_isize << BITS; LL | let n = 1_isize << BITS;
| ^^^^^^^^^^^^^^^ attempt to shift left by %BITS% which would overflow | ^^^^^^^^^^^^^^^ attempt to shift left by `64_usize`, which would overflow
warning: this arithmetic operation will overflow warning: this arithmetic operation will overflow
--> $DIR/lint-exceeding-bitshifts.rs:78:15 --> $DIR/lint-exceeding-bitshifts.rs:78:15
| |
LL | let n = 1_usize << BITS; LL | let n = 1_usize << BITS;
| ^^^^^^^^^^^^^^^ attempt to shift left by %BITS% which would overflow | ^^^^^^^^^^^^^^^ attempt to shift left by `64_usize`, which would overflow
warning: 24 warnings emitted warning: 24 warnings emitted

View file

@ -2,7 +2,7 @@ error: this operation will panic at runtime
--> $DIR/mir_detects_invalid_ops.rs:11:14 --> $DIR/mir_detects_invalid_ops.rs:11:14
| |
LL | let _z = 1 / y; LL | let _z = 1 / y;
| ^^^^^ attempt to divide 1_i32 by zero | ^^^^^ attempt to divide `1_i32` by zero
| |
= note: `#[deny(unconditional_panic)]` on by default = note: `#[deny(unconditional_panic)]` on by default
@ -10,7 +10,7 @@ error: this operation will panic at runtime
--> $DIR/mir_detects_invalid_ops.rs:16:14 --> $DIR/mir_detects_invalid_ops.rs:16:14
| |
LL | let _z = 1 % y; LL | let _z = 1 % y;
| ^^^^^ attempt to calculate the remainder of 1_i32 with a divisor of zero | ^^^^^ attempt to calculate the remainder of `1_i32` with a divisor of zero
error: aborting due to 2 previous errors error: aborting due to 2 previous errors

View file

@ -2,7 +2,7 @@ error: this arithmetic operation will overflow
--> $DIR/overflowing-lsh-1.rs:7:14 --> $DIR/overflowing-lsh-1.rs:7:14
| |
LL | let _x = 1_i32 << 32; LL | let _x = 1_i32 << 32;
| ^^^^^^^^^^^ attempt to shift left by 32_i32 which would overflow | ^^^^^^^^^^^ attempt to shift left by `32_i32`, which would overflow
| |
note: the lint level is defined here note: the lint level is defined here
--> $DIR/overflowing-lsh-1.rs:4:9 --> $DIR/overflowing-lsh-1.rs:4:9

View file

@ -2,7 +2,7 @@ error: this arithmetic operation will overflow
--> $DIR/overflowing-lsh-2.rs:7:14 --> $DIR/overflowing-lsh-2.rs:7:14
| |
LL | let _x = 1 << -1; LL | let _x = 1 << -1;
| ^^^^^^^ attempt to shift left by -1_i32 which would overflow | ^^^^^^^ attempt to shift left by `-1_i32`, which would overflow
| |
note: the lint level is defined here note: the lint level is defined here
--> $DIR/overflowing-lsh-2.rs:4:9 --> $DIR/overflowing-lsh-2.rs:4:9

View file

@ -2,7 +2,7 @@ error: this arithmetic operation will overflow
--> $DIR/overflowing-lsh-3.rs:7:14 --> $DIR/overflowing-lsh-3.rs:7:14
| |
LL | let _x = 1_u64 << 64; LL | let _x = 1_u64 << 64;
| ^^^^^^^^^^^ attempt to shift left by 64_i32 which would overflow | ^^^^^^^^^^^ attempt to shift left by `64_i32`, which would overflow
| |
note: the lint level is defined here note: the lint level is defined here
--> $DIR/overflowing-lsh-3.rs:4:9 --> $DIR/overflowing-lsh-3.rs:4:9

View file

@ -2,7 +2,7 @@ error: this arithmetic operation will overflow
--> $DIR/overflowing-lsh-4.rs:11:13 --> $DIR/overflowing-lsh-4.rs:11:13
| |
LL | let x = 1_i8 << 17; LL | let x = 1_i8 << 17;
| ^^^^^^^^^^ attempt to shift left by 17_i32 which would overflow | ^^^^^^^^^^ attempt to shift left by `17_i32`, which would overflow
| |
note: the lint level is defined here note: the lint level is defined here
--> $DIR/overflowing-lsh-4.rs:7:9 --> $DIR/overflowing-lsh-4.rs:7:9

View file

@ -2,7 +2,7 @@ error: this arithmetic operation will overflow
--> $DIR/overflowing-rsh-1.rs:7:14 --> $DIR/overflowing-rsh-1.rs:7:14
| |
LL | let _x = -1_i32 >> 32; LL | let _x = -1_i32 >> 32;
| ^^^^^^^^^^^^ attempt to shift right by 32_i32 which would overflow | ^^^^^^^^^^^^ attempt to shift right by `32_i32`, which would overflow
| |
note: the lint level is defined here note: the lint level is defined here
--> $DIR/overflowing-rsh-1.rs:4:9 --> $DIR/overflowing-rsh-1.rs:4:9

View file

@ -2,7 +2,7 @@ error: this arithmetic operation will overflow
--> $DIR/overflowing-rsh-2.rs:7:14 --> $DIR/overflowing-rsh-2.rs:7:14
| |
LL | let _x = -1_i32 >> -1; LL | let _x = -1_i32 >> -1;
| ^^^^^^^^^^^^ attempt to shift right by -1_i32 which would overflow | ^^^^^^^^^^^^ attempt to shift right by `-1_i32`, which would overflow
| |
note: the lint level is defined here note: the lint level is defined here
--> $DIR/overflowing-rsh-2.rs:4:9 --> $DIR/overflowing-rsh-2.rs:4:9

View file

@ -2,7 +2,7 @@ error: this arithmetic operation will overflow
--> $DIR/overflowing-rsh-3.rs:7:14 --> $DIR/overflowing-rsh-3.rs:7:14
| |
LL | let _x = -1_i64 >> 64; LL | let _x = -1_i64 >> 64;
| ^^^^^^^^^^^^ attempt to shift right by 64_i32 which would overflow | ^^^^^^^^^^^^ attempt to shift right by `64_i32`, which would overflow
| |
note: the lint level is defined here note: the lint level is defined here
--> $DIR/overflowing-rsh-3.rs:4:9 --> $DIR/overflowing-rsh-3.rs:4:9

View file

@ -2,7 +2,7 @@ error: this arithmetic operation will overflow
--> $DIR/overflowing-rsh-4.rs:11:13 --> $DIR/overflowing-rsh-4.rs:11:13
| |
LL | let x = 2_i8 >> 17; LL | let x = 2_i8 >> 17;
| ^^^^^^^^^^ attempt to shift right by 17_i32 which would overflow | ^^^^^^^^^^ attempt to shift right by `17_i32`, which would overflow
| |
note: the lint level is defined here note: the lint level is defined here
--> $DIR/overflowing-rsh-4.rs:7:9 --> $DIR/overflowing-rsh-4.rs:7:9

View file

@ -2,7 +2,7 @@ error: this arithmetic operation will overflow
--> $DIR/overflowing-rsh-5.rs:7:14 --> $DIR/overflowing-rsh-5.rs:7:14
| |
LL | let _n = 1i64 >> [64][0]; LL | let _n = 1i64 >> [64][0];
| ^^^^^^^^^^^^^^^ attempt to shift right by 64_i32 which would overflow | ^^^^^^^^^^^^^^^ attempt to shift right by `64_i32`, which would overflow
| |
note: the lint level is defined here note: the lint level is defined here
--> $DIR/overflowing-rsh-5.rs:4:9 --> $DIR/overflowing-rsh-5.rs:4:9

View file

@ -2,7 +2,7 @@ error: this arithmetic operation will overflow
--> $DIR/overflowing-rsh-6.rs:7:14 --> $DIR/overflowing-rsh-6.rs:7:14
| |
LL | let _n = 1i64 >> [64][0]; LL | let _n = 1i64 >> [64][0];
| ^^^^^^^^^^^^^^^ attempt to shift right by 64_i32 which would overflow | ^^^^^^^^^^^^^^^ attempt to shift right by `64_i32`, which would overflow
| |
note: the lint level is defined here note: the lint level is defined here
--> $DIR/overflowing-rsh-6.rs:4:9 --> $DIR/overflowing-rsh-6.rs:4:9