Update wording on E0080
Change "attempted" to "attempt"
This commit is contained in:
parent
9cf189701e
commit
e5e4cccd3b
@ -23,7 +23,7 @@ code example:
|
|||||||
#[deny(const_err)]
|
#[deny(const_err)]
|
||||||
|
|
||||||
const X: i32 = 42 / 0;
|
const X: i32 = 42 / 0;
|
||||||
// error: attempted to divide by zero in a constant expression
|
// error: attempt to divide by zero in a constant expression
|
||||||
```
|
```
|
||||||
"##,
|
"##,
|
||||||
|
|
||||||
|
@ -57,18 +57,18 @@ impl ConstMathErr {
|
|||||||
UnequalTypes(BitOr) => "tried to bitor two values of different types",
|
UnequalTypes(BitOr) => "tried to bitor two values of different types",
|
||||||
UnequalTypes(BitXor) => "tried to xor two values of different types",
|
UnequalTypes(BitXor) => "tried to xor two values of different types",
|
||||||
UnequalTypes(_) => unreachable!(),
|
UnequalTypes(_) => unreachable!(),
|
||||||
Overflow(Add) => "attempted to add with overflow",
|
Overflow(Add) => "attempt to add with overflow",
|
||||||
Overflow(Sub) => "attempted to subtract with overflow",
|
Overflow(Sub) => "attempt to subtract with overflow",
|
||||||
Overflow(Mul) => "attempted to multiply with overflow",
|
Overflow(Mul) => "attempt to multiply with overflow",
|
||||||
Overflow(Div) => "attempted to divide with overflow",
|
Overflow(Div) => "attempt to divide with overflow",
|
||||||
Overflow(Rem) => "attempted to calculate the remainder with overflow",
|
Overflow(Rem) => "attempt to calculate the remainder with overflow",
|
||||||
Overflow(Neg) => "attempted to negate with overflow",
|
Overflow(Neg) => "attempt to negate with overflow",
|
||||||
Overflow(Shr) => "attempted to shift right with overflow",
|
Overflow(Shr) => "attempt to shift right with overflow",
|
||||||
Overflow(Shl) => "attempted to shift left with overflow",
|
Overflow(Shl) => "attempt to shift left with overflow",
|
||||||
Overflow(_) => unreachable!(),
|
Overflow(_) => unreachable!(),
|
||||||
ShiftNegative => "attempted to shift by a negative amount",
|
ShiftNegative => "attempt to shift by a negative amount",
|
||||||
DivisionByZero => "attempted to divide by zero",
|
DivisionByZero => "attempt to divide by zero",
|
||||||
RemainderByZero => "attempted to calculate the remainder with a divisor of zero",
|
RemainderByZero => "attempt to calculate the remainder with a divisor of zero",
|
||||||
UnsignedNegation => "unary negation of unsigned integer",
|
UnsignedNegation => "unary negation of unsigned integer",
|
||||||
ULitOutOfRange(ast::UintTy::U8) => "literal out of range for u8",
|
ULitOutOfRange(ast::UintTy::U8) => "literal out of range for u8",
|
||||||
ULitOutOfRange(ast::UintTy::U16) => "literal out of range for u16",
|
ULitOutOfRange(ast::UintTy::U16) => "literal out of range for u16",
|
||||||
|
@ -1512,7 +1512,7 @@ fn trans_unary<'blk, 'tcx>(bcx: Block<'blk, 'tcx>,
|
|||||||
C_integral(llty, min, true), debug_loc);
|
C_integral(llty, min, true), debug_loc);
|
||||||
with_cond(bcx, is_min, |bcx| {
|
with_cond(bcx, is_min, |bcx| {
|
||||||
let msg = InternedString::new(
|
let msg = InternedString::new(
|
||||||
"attempted to negate with overflow");
|
"attempt to negate with overflow");
|
||||||
controlflow::trans_fail(bcx, expr_info(expr), msg)
|
controlflow::trans_fail(bcx, expr_info(expr), msg)
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
|
@ -11,10 +11,10 @@
|
|||||||
#![feature(const_indexing)]
|
#![feature(const_indexing)]
|
||||||
#![deny(const_err)]
|
#![deny(const_err)]
|
||||||
|
|
||||||
pub const A: i8 = -std::i8::MIN; //~ ERROR attempted to negate with overflow
|
pub const A: i8 = -std::i8::MIN; //~ ERROR attempt to negate with overflow
|
||||||
pub const B: u8 = 200u8 + 200u8; //~ ERROR attempted to add with overflow
|
pub const B: u8 = 200u8 + 200u8; //~ ERROR attempt to add with overflow
|
||||||
pub const C: u8 = 200u8 * 4; //~ ERROR attempted to multiply with overflow
|
pub const C: u8 = 200u8 * 4; //~ ERROR attempt to multiply with overflow
|
||||||
pub const D: u8 = 42u8 - (42u8 + 1); //~ ERROR attempted to subtract with overflow
|
pub const D: u8 = 42u8 - (42u8 + 1); //~ ERROR attempt to subtract with overflow
|
||||||
pub const E: u8 = [5u8][1];
|
pub const E: u8 = [5u8][1];
|
||||||
//~^ ERROR index out of bounds: the len is 1 but the index is 1
|
//~^ ERROR index out of bounds: the len is 1 but the index is 1
|
||||||
|
|
||||||
|
@ -10,7 +10,7 @@
|
|||||||
|
|
||||||
#![deny(const_err)]
|
#![deny(const_err)]
|
||||||
|
|
||||||
pub const A: i8 = -std::i8::MIN; //~ ERROR attempted to negate with overflow
|
pub const A: i8 = -std::i8::MIN; //~ ERROR attempt to negate with overflow
|
||||||
pub const B: i8 = A;
|
pub const B: i8 = A;
|
||||||
pub const C: u8 = A as u8;
|
pub const C: u8 = A as u8;
|
||||||
pub const D: i8 = 50 - A;
|
pub const D: i8 = 50 - A;
|
||||||
|
@ -30,18 +30,18 @@ const FOO: u8 = [5u8][1];
|
|||||||
fn main() {
|
fn main() {
|
||||||
let a = -std::i8::MIN;
|
let a = -std::i8::MIN;
|
||||||
//~^ WARN this expression will panic at run-time
|
//~^ WARN this expression will panic at run-time
|
||||||
//~| attempted to negate with overflow
|
//~| attempt to negate with overflow
|
||||||
let b = 200u8 + 200u8 + 200u8;
|
let b = 200u8 + 200u8 + 200u8;
|
||||||
//~^ WARN this expression will panic at run-time
|
//~^ WARN this expression will panic at run-time
|
||||||
//~| attempted to add with overflow
|
//~| attempt to add with overflow
|
||||||
//~^^^ WARN this expression will panic at run-time
|
//~^^^ WARN this expression will panic at run-time
|
||||||
//~| attempted to add with overflow
|
//~| attempt to add with overflow
|
||||||
let c = 200u8 * 4;
|
let c = 200u8 * 4;
|
||||||
//~^ WARN this expression will panic at run-time
|
//~^ WARN this expression will panic at run-time
|
||||||
//~| attempted to multiply with overflow
|
//~| attempt to multiply with overflow
|
||||||
let d = 42u8 - (42u8 + 1);
|
let d = 42u8 - (42u8 + 1);
|
||||||
//~^ WARN this expression will panic at run-time
|
//~^ WARN this expression will panic at run-time
|
||||||
//~| attempted to subtract with overflow
|
//~| attempt to subtract with overflow
|
||||||
let _e = [5u8][1];
|
let _e = [5u8][1];
|
||||||
//~^ WARN this expression will panic at run-time
|
//~^ WARN this expression will panic at run-time
|
||||||
//~| index out of bounds: the len is 1 but the index is 1
|
//~| index out of bounds: the len is 1 but the index is 1
|
||||||
|
@ -18,14 +18,14 @@ fn black_box<T>(_: T) {
|
|||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
let a = -std::i8::MIN;
|
let a = -std::i8::MIN;
|
||||||
//~^ ERROR attempted to negate with overflow
|
//~^ ERROR attempt to negate with overflow
|
||||||
let b = 200u8 + 200u8 + 200u8;
|
let b = 200u8 + 200u8 + 200u8;
|
||||||
//~^ ERROR attempted to add with overflow
|
//~^ ERROR attempt to add with overflow
|
||||||
//~| ERROR attempted to add with overflow
|
//~| ERROR attempt to add with overflow
|
||||||
let c = 200u8 * 4;
|
let c = 200u8 * 4;
|
||||||
//~^ ERROR attempted to multiply with overflow
|
//~^ ERROR attempt to multiply with overflow
|
||||||
let d = 42u8 - (42u8 + 1);
|
let d = 42u8 - (42u8 + 1);
|
||||||
//~^ ERROR attempted to subtract with overflow
|
//~^ ERROR attempt to subtract with overflow
|
||||||
let _e = [5u8][1];
|
let _e = [5u8][1];
|
||||||
black_box(a);
|
black_box(a);
|
||||||
black_box(b);
|
black_box(b);
|
||||||
|
@ -20,11 +20,11 @@ use std::{u8, u16, u32, u64, usize};
|
|||||||
const NEG_128: i8 = -128;
|
const NEG_128: i8 = -128;
|
||||||
const NEG_NEG_128: i8 = -NEG_128;
|
const NEG_NEG_128: i8 = -NEG_128;
|
||||||
//~^ ERROR constant evaluation error
|
//~^ ERROR constant evaluation error
|
||||||
//~| attempted to negate with overflow
|
//~| attempt to negate with overflow
|
||||||
//~| ERROR constant evaluation error
|
//~| ERROR constant evaluation error
|
||||||
//~| attempted to negate with overflow
|
//~| attempt to negate with overflow
|
||||||
//~| ERROR constant evaluation error
|
//~| ERROR constant evaluation error
|
||||||
//~| attempted to negate with overflow
|
//~| attempt to negate with overflow
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
match -128i8 {
|
match -128i8 {
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
// self-hosted and a cross-compiled setup; therefore resorting to
|
// self-hosted and a cross-compiled setup; therefore resorting to
|
||||||
// error-pattern for now.
|
// error-pattern for now.
|
||||||
|
|
||||||
// error-pattern: attempted to add with overflow
|
// error-pattern: attempt to add with overflow
|
||||||
|
|
||||||
#![allow(unused_imports)]
|
#![allow(unused_imports)]
|
||||||
|
|
||||||
|
@ -23,7 +23,7 @@ use std::{u8, u16, u32, u64, usize};
|
|||||||
|
|
||||||
const A_I8_T
|
const A_I8_T
|
||||||
: [u32; (i8::MAX as i8 + 1i8) as usize]
|
: [u32; (i8::MAX as i8 + 1i8) as usize]
|
||||||
//~^ ERROR error evaluating count: attempted to add with overflow
|
//~^ ERROR error evaluating count: attempt to add with overflow
|
||||||
= [0; (i8::MAX as usize) + 1];
|
= [0; (i8::MAX as usize) + 1];
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
|
@ -22,113 +22,113 @@ use std::{u8, u16, u32, u64, usize};
|
|||||||
const VALS_I8: (i8, i8, i8, i8) =
|
const VALS_I8: (i8, i8, i8, i8) =
|
||||||
(-i8::MIN,
|
(-i8::MIN,
|
||||||
//~^ ERROR constant evaluation error
|
//~^ ERROR constant evaluation error
|
||||||
//~| attempted to negate with overflow
|
//~| attempt to negate with overflow
|
||||||
i8::MIN - 1,
|
i8::MIN - 1,
|
||||||
//~^ ERROR constant evaluation error
|
//~^ ERROR constant evaluation error
|
||||||
//~| attempted to subtract with overflow
|
//~| attempt to subtract with overflow
|
||||||
i8::MAX + 1,
|
i8::MAX + 1,
|
||||||
//~^ ERROR constant evaluation error
|
//~^ ERROR constant evaluation error
|
||||||
//~| attempted to add with overflow
|
//~| attempt to add with overflow
|
||||||
i8::MIN * 2,
|
i8::MIN * 2,
|
||||||
//~^ ERROR constant evaluation error
|
//~^ ERROR constant evaluation error
|
||||||
//~| attempted to multiply with overflow
|
//~| attempt to multiply with overflow
|
||||||
);
|
);
|
||||||
|
|
||||||
const VALS_I16: (i16, i16, i16, i16) =
|
const VALS_I16: (i16, i16, i16, i16) =
|
||||||
(-i16::MIN,
|
(-i16::MIN,
|
||||||
//~^ ERROR constant evaluation error
|
//~^ ERROR constant evaluation error
|
||||||
//~| attempted to negate with overflow
|
//~| attempt to negate with overflow
|
||||||
i16::MIN - 1,
|
i16::MIN - 1,
|
||||||
//~^ ERROR constant evaluation error
|
//~^ ERROR constant evaluation error
|
||||||
//~| attempted to subtract with overflow
|
//~| attempt to subtract with overflow
|
||||||
i16::MAX + 1,
|
i16::MAX + 1,
|
||||||
//~^ ERROR constant evaluation error
|
//~^ ERROR constant evaluation error
|
||||||
//~| attempted to add with overflow
|
//~| attempt to add with overflow
|
||||||
i16::MIN * 2,
|
i16::MIN * 2,
|
||||||
//~^ ERROR constant evaluation error
|
//~^ ERROR constant evaluation error
|
||||||
//~| attempted to multiply with overflow
|
//~| attempt to multiply with overflow
|
||||||
);
|
);
|
||||||
|
|
||||||
const VALS_I32: (i32, i32, i32, i32) =
|
const VALS_I32: (i32, i32, i32, i32) =
|
||||||
(-i32::MIN,
|
(-i32::MIN,
|
||||||
//~^ ERROR constant evaluation error
|
//~^ ERROR constant evaluation error
|
||||||
//~| attempted to negate with overflow
|
//~| attempt to negate with overflow
|
||||||
i32::MIN - 1,
|
i32::MIN - 1,
|
||||||
//~^ ERROR constant evaluation error
|
//~^ ERROR constant evaluation error
|
||||||
//~| attempted to subtract with overflow
|
//~| attempt to subtract with overflow
|
||||||
i32::MAX + 1,
|
i32::MAX + 1,
|
||||||
//~^ ERROR constant evaluation error
|
//~^ ERROR constant evaluation error
|
||||||
//~| attempted to add with overflow
|
//~| attempt to add with overflow
|
||||||
i32::MIN * 2,
|
i32::MIN * 2,
|
||||||
//~^ ERROR constant evaluation error
|
//~^ ERROR constant evaluation error
|
||||||
//~| attempted to multiply with overflow
|
//~| attempt to multiply with overflow
|
||||||
);
|
);
|
||||||
|
|
||||||
const VALS_I64: (i64, i64, i64, i64) =
|
const VALS_I64: (i64, i64, i64, i64) =
|
||||||
(-i64::MIN,
|
(-i64::MIN,
|
||||||
//~^ ERROR constant evaluation error
|
//~^ ERROR constant evaluation error
|
||||||
//~| attempted to negate with overflow
|
//~| attempt to negate with overflow
|
||||||
i64::MIN - 1,
|
i64::MIN - 1,
|
||||||
//~^ ERROR constant evaluation error
|
//~^ ERROR constant evaluation error
|
||||||
//~| attempted to subtract with overflow
|
//~| attempt to subtract with overflow
|
||||||
i64::MAX + 1,
|
i64::MAX + 1,
|
||||||
//~^ ERROR constant evaluation error
|
//~^ ERROR constant evaluation error
|
||||||
//~| attempted to add with overflow
|
//~| attempt to add with overflow
|
||||||
i64::MAX * 2,
|
i64::MAX * 2,
|
||||||
//~^ ERROR constant evaluation error
|
//~^ ERROR constant evaluation error
|
||||||
//~| attempted to multiply with overflow
|
//~| attempt to multiply with overflow
|
||||||
);
|
);
|
||||||
|
|
||||||
const VALS_U8: (u8, u8, u8, u8) =
|
const VALS_U8: (u8, u8, u8, u8) =
|
||||||
(-(u8::MIN as i8) as u8,
|
(-(u8::MIN as i8) as u8,
|
||||||
u8::MIN - 1,
|
u8::MIN - 1,
|
||||||
//~^ ERROR constant evaluation error
|
//~^ ERROR constant evaluation error
|
||||||
//~| attempted to subtract with overflow
|
//~| attempt to subtract with overflow
|
||||||
u8::MAX + 1,
|
u8::MAX + 1,
|
||||||
//~^ ERROR constant evaluation error
|
//~^ ERROR constant evaluation error
|
||||||
//~| attempted to add with overflow
|
//~| attempt to add with overflow
|
||||||
u8::MAX * 2,
|
u8::MAX * 2,
|
||||||
//~^ ERROR constant evaluation error
|
//~^ ERROR constant evaluation error
|
||||||
//~| attempted to multiply with overflow
|
//~| attempt to multiply with overflow
|
||||||
);
|
);
|
||||||
|
|
||||||
const VALS_U16: (u16, u16, u16, u16) =
|
const VALS_U16: (u16, u16, u16, u16) =
|
||||||
(-(u16::MIN as i16) as u16,
|
(-(u16::MIN as i16) as u16,
|
||||||
u16::MIN - 1,
|
u16::MIN - 1,
|
||||||
//~^ ERROR constant evaluation error
|
//~^ ERROR constant evaluation error
|
||||||
//~| attempted to subtract with overflow
|
//~| attempt to subtract with overflow
|
||||||
u16::MAX + 1,
|
u16::MAX + 1,
|
||||||
//~^ ERROR constant evaluation error
|
//~^ ERROR constant evaluation error
|
||||||
//~| attempted to add with overflow
|
//~| attempt to add with overflow
|
||||||
u16::MAX * 2,
|
u16::MAX * 2,
|
||||||
//~^ ERROR constant evaluation error
|
//~^ ERROR constant evaluation error
|
||||||
//~| attempted to multiply with overflow
|
//~| attempt to multiply with overflow
|
||||||
);
|
);
|
||||||
|
|
||||||
const VALS_U32: (u32, u32, u32, u32) =
|
const VALS_U32: (u32, u32, u32, u32) =
|
||||||
(-(u32::MIN as i32) as u32,
|
(-(u32::MIN as i32) as u32,
|
||||||
u32::MIN - 1,
|
u32::MIN - 1,
|
||||||
//~^ ERROR constant evaluation error
|
//~^ ERROR constant evaluation error
|
||||||
//~| attempted to subtract with overflow
|
//~| attempt to subtract with overflow
|
||||||
u32::MAX + 1,
|
u32::MAX + 1,
|
||||||
//~^ ERROR constant evaluation error
|
//~^ ERROR constant evaluation error
|
||||||
//~| attempted to add with overflow
|
//~| attempt to add with overflow
|
||||||
u32::MAX * 2,
|
u32::MAX * 2,
|
||||||
//~^ ERROR constant evaluation error
|
//~^ ERROR constant evaluation error
|
||||||
//~| attempted to multiply with overflow
|
//~| attempt to multiply with overflow
|
||||||
);
|
);
|
||||||
|
|
||||||
const VALS_U64: (u64, u64, u64, u64) =
|
const VALS_U64: (u64, u64, u64, u64) =
|
||||||
(-(u64::MIN as i64) as u64,
|
(-(u64::MIN as i64) as u64,
|
||||||
u64::MIN - 1,
|
u64::MIN - 1,
|
||||||
//~^ ERROR constant evaluation error
|
//~^ ERROR constant evaluation error
|
||||||
//~| attempted to subtract with overflow
|
//~| attempt to subtract with overflow
|
||||||
u64::MAX + 1,
|
u64::MAX + 1,
|
||||||
//~^ ERROR constant evaluation error
|
//~^ ERROR constant evaluation error
|
||||||
//~| attempted to add with overflow
|
//~| attempt to add with overflow
|
||||||
u64::MAX * 2,
|
u64::MAX * 2,
|
||||||
//~^ ERROR constant evaluation error
|
//~^ ERROR constant evaluation error
|
||||||
//~| attempted to multiply with overflow
|
//~| attempt to multiply with overflow
|
||||||
);
|
);
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
|
@ -16,7 +16,7 @@ const ONE: usize = 1;
|
|||||||
const TWO: usize = 2;
|
const TWO: usize = 2;
|
||||||
const LEN: usize = ONE - TWO;
|
const LEN: usize = ONE - TWO;
|
||||||
//~^ ERROR E0080
|
//~^ ERROR E0080
|
||||||
//~| attempted to subtract with overflow
|
//~| attempt to subtract with overflow
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
let a: [i8; LEN] = unimplemented!();
|
let a: [i8; LEN] = unimplemented!();
|
||||||
|
@ -17,5 +17,5 @@ const TWO: usize = 2;
|
|||||||
fn main() {
|
fn main() {
|
||||||
let a: [i8; ONE - TWO] = unimplemented!();
|
let a: [i8; ONE - TWO] = unimplemented!();
|
||||||
//~^ ERROR constant evaluation error [E0080]
|
//~^ ERROR constant evaluation error [E0080]
|
||||||
//~| attempted to subtract with overflow
|
//~| attempt to subtract with overflow
|
||||||
}
|
}
|
||||||
|
@ -12,7 +12,7 @@
|
|||||||
|
|
||||||
const TUP: (usize,) = 5 << 64;
|
const TUP: (usize,) = 5 << 64;
|
||||||
//~^ ERROR E0080
|
//~^ ERROR E0080
|
||||||
//~| attempted to shift left with overflow
|
//~| attempt to shift left with overflow
|
||||||
const ARR: [i32; TUP.0] = [];
|
const ARR: [i32; TUP.0] = [];
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
|
@ -10,10 +10,10 @@
|
|||||||
|
|
||||||
enum test {
|
enum test {
|
||||||
div_zero = 1/0, //~ ERROR E0080
|
div_zero = 1/0, //~ ERROR E0080
|
||||||
//~| attempted to divide by zero
|
//~| attempt to divide by zero
|
||||||
rem_zero = 1%0,
|
rem_zero = 1%0,
|
||||||
//~^ ERROR E0080
|
//~^ ERROR E0080
|
||||||
//~| attempted to calculate the remainder with a divisor of zero
|
//~| attempt to calculate the remainder with a divisor of zero
|
||||||
}
|
}
|
||||||
|
|
||||||
fn main() {}
|
fn main() {}
|
||||||
|
@ -15,43 +15,43 @@ use std::thread;
|
|||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
assert!(thread::spawn(move|| { isize::MIN / -1; }).join().is_err());
|
assert!(thread::spawn(move|| { isize::MIN / -1; }).join().is_err());
|
||||||
//~^ ERROR attempted to divide with overflow
|
//~^ ERROR attempt to divide with overflow
|
||||||
assert!(thread::spawn(move|| { i8::MIN / -1; }).join().is_err());
|
assert!(thread::spawn(move|| { i8::MIN / -1; }).join().is_err());
|
||||||
//~^ ERROR attempted to divide with overflow
|
//~^ ERROR attempt to divide with overflow
|
||||||
assert!(thread::spawn(move|| { i16::MIN / -1; }).join().is_err());
|
assert!(thread::spawn(move|| { i16::MIN / -1; }).join().is_err());
|
||||||
//~^ ERROR attempted to divide with overflow
|
//~^ ERROR attempt to divide with overflow
|
||||||
assert!(thread::spawn(move|| { i32::MIN / -1; }).join().is_err());
|
assert!(thread::spawn(move|| { i32::MIN / -1; }).join().is_err());
|
||||||
//~^ ERROR attempted to divide with overflow
|
//~^ ERROR attempt to divide with overflow
|
||||||
assert!(thread::spawn(move|| { i64::MIN / -1; }).join().is_err());
|
assert!(thread::spawn(move|| { i64::MIN / -1; }).join().is_err());
|
||||||
//~^ ERROR attempted to divide with overflow
|
//~^ ERROR attempt to divide with overflow
|
||||||
assert!(thread::spawn(move|| { 1isize / 0; }).join().is_err());
|
assert!(thread::spawn(move|| { 1isize / 0; }).join().is_err());
|
||||||
//~^ ERROR attempted to divide by zero
|
//~^ ERROR attempt to divide by zero
|
||||||
assert!(thread::spawn(move|| { 1i8 / 0; }).join().is_err());
|
assert!(thread::spawn(move|| { 1i8 / 0; }).join().is_err());
|
||||||
//~^ ERROR attempted to divide by zero
|
//~^ ERROR attempt to divide by zero
|
||||||
assert!(thread::spawn(move|| { 1i16 / 0; }).join().is_err());
|
assert!(thread::spawn(move|| { 1i16 / 0; }).join().is_err());
|
||||||
//~^ ERROR attempted to divide by zero
|
//~^ ERROR attempt to divide by zero
|
||||||
assert!(thread::spawn(move|| { 1i32 / 0; }).join().is_err());
|
assert!(thread::spawn(move|| { 1i32 / 0; }).join().is_err());
|
||||||
//~^ ERROR attempted to divide by zero
|
//~^ ERROR attempt to divide by zero
|
||||||
assert!(thread::spawn(move|| { 1i64 / 0; }).join().is_err());
|
assert!(thread::spawn(move|| { 1i64 / 0; }).join().is_err());
|
||||||
//~^ ERROR attempted to divide by zero
|
//~^ ERROR attempt to divide by zero
|
||||||
assert!(thread::spawn(move|| { isize::MIN % -1; }).join().is_err());
|
assert!(thread::spawn(move|| { isize::MIN % -1; }).join().is_err());
|
||||||
//~^ ERROR attempted to calculate the remainder with overflow
|
//~^ ERROR attempt to calculate the remainder with overflow
|
||||||
assert!(thread::spawn(move|| { i8::MIN % -1; }).join().is_err());
|
assert!(thread::spawn(move|| { i8::MIN % -1; }).join().is_err());
|
||||||
//~^ ERROR attempted to calculate the remainder with overflow
|
//~^ ERROR attempt to calculate the remainder with overflow
|
||||||
assert!(thread::spawn(move|| { i16::MIN % -1; }).join().is_err());
|
assert!(thread::spawn(move|| { i16::MIN % -1; }).join().is_err());
|
||||||
//~^ ERROR attempted to calculate the remainder with overflow
|
//~^ ERROR attempt to calculate the remainder with overflow
|
||||||
assert!(thread::spawn(move|| { i32::MIN % -1; }).join().is_err());
|
assert!(thread::spawn(move|| { i32::MIN % -1; }).join().is_err());
|
||||||
//~^ ERROR attempted to calculate the remainder with overflow
|
//~^ ERROR attempt to calculate the remainder with overflow
|
||||||
assert!(thread::spawn(move|| { i64::MIN % -1; }).join().is_err());
|
assert!(thread::spawn(move|| { i64::MIN % -1; }).join().is_err());
|
||||||
//~^ ERROR attempted to calculate the remainder with overflow
|
//~^ ERROR attempt to calculate the remainder with overflow
|
||||||
assert!(thread::spawn(move|| { 1isize % 0; }).join().is_err());
|
assert!(thread::spawn(move|| { 1isize % 0; }).join().is_err());
|
||||||
//~^ ERROR attempted to calculate the remainder with a divisor of zero
|
//~^ ERROR attempt to calculate the remainder with a divisor of zero
|
||||||
assert!(thread::spawn(move|| { 1i8 % 0; }).join().is_err());
|
assert!(thread::spawn(move|| { 1i8 % 0; }).join().is_err());
|
||||||
//~^ ERROR attempted to calculate the remainder with a divisor of zero
|
//~^ ERROR attempt to calculate the remainder with a divisor of zero
|
||||||
assert!(thread::spawn(move|| { 1i16 % 0; }).join().is_err());
|
assert!(thread::spawn(move|| { 1i16 % 0; }).join().is_err());
|
||||||
//~^ ERROR attempted to calculate the remainder with a divisor of zero
|
//~^ ERROR attempt to calculate the remainder with a divisor of zero
|
||||||
assert!(thread::spawn(move|| { 1i32 % 0; }).join().is_err());
|
assert!(thread::spawn(move|| { 1i32 % 0; }).join().is_err());
|
||||||
//~^ ERROR attempted to calculate the remainder with a divisor of zero
|
//~^ ERROR attempt to calculate the remainder with a divisor of zero
|
||||||
assert!(thread::spawn(move|| { 1i64 % 0; }).join().is_err());
|
assert!(thread::spawn(move|| { 1i64 % 0; }).join().is_err());
|
||||||
//~^ ERROR attempted to calculate the remainder with a divisor of zero
|
//~^ ERROR attempt to calculate the remainder with a divisor of zero
|
||||||
}
|
}
|
||||||
|
@ -53,7 +53,7 @@ fn main() {
|
|||||||
let n = n << 8; //~ ERROR: bitshift exceeds the type's number of bits
|
let n = n << 8; //~ ERROR: bitshift exceeds the type's number of bits
|
||||||
|
|
||||||
let n = 1u8 << -8; //~ ERROR: bitshift exceeds the type's number of bits
|
let n = 1u8 << -8; //~ ERROR: bitshift exceeds the type's number of bits
|
||||||
//~^ WARN: attempted to shift by a negative amount
|
//~^ WARN: attempt to shift by a negative amount
|
||||||
|
|
||||||
let n = 1u8 << (4+3);
|
let n = 1u8 << (4+3);
|
||||||
let n = 1u8 << (4+4); //~ ERROR: bitshift exceeds the type's number of bits
|
let n = 1u8 << (4+4); //~ ERROR: bitshift exceeds the type's number of bits
|
||||||
|
@ -15,7 +15,7 @@
|
|||||||
#[allow(unused_variables)]
|
#[allow(unused_variables)]
|
||||||
fn main() {
|
fn main() {
|
||||||
let x2: i8 = --128; //~ error: literal out of range for i8
|
let x2: i8 = --128; //~ error: literal out of range for i8
|
||||||
//~^ error: attempted to negate with overflow
|
//~^ error: attempt to negate with overflow
|
||||||
|
|
||||||
let x = -3.40282348e+38_f32; //~ error: literal out of range for f32
|
let x = -3.40282348e+38_f32; //~ error: literal out of range for f32
|
||||||
let x = 3.40282348e+38_f32; //~ error: literal out of range for f32
|
let x = 3.40282348e+38_f32; //~ error: literal out of range for f32
|
||||||
|
@ -10,7 +10,7 @@
|
|||||||
|
|
||||||
// ignore-pretty : (#23623) problems when ending with // comments
|
// ignore-pretty : (#23623) problems when ending with // comments
|
||||||
|
|
||||||
// error-pattern:attempted to divide by zero
|
// error-pattern:attempt to divide by zero
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
let y = 0;
|
let y = 0;
|
||||||
|
@ -10,7 +10,7 @@
|
|||||||
|
|
||||||
// ignore-pretty : (#23623) problems when ending with // comments
|
// ignore-pretty : (#23623) problems when ending with // comments
|
||||||
|
|
||||||
// error-pattern:attempted to calculate the remainder with a divisor of zero
|
// error-pattern:attempt to calculate the remainder with a divisor of zero
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
let y = 0;
|
let y = 0;
|
||||||
|
@ -10,7 +10,7 @@
|
|||||||
|
|
||||||
// ignore-pretty : (#23623) problems when ending with // comments
|
// ignore-pretty : (#23623) problems when ending with // comments
|
||||||
|
|
||||||
// error-pattern:thread 'main' panicked at 'attempted to add with overflow'
|
// error-pattern:thread 'main' panicked at 'attempt to add with overflow'
|
||||||
// compile-flags: -C debug-assertions
|
// compile-flags: -C debug-assertions
|
||||||
|
|
||||||
|
|
||||||
|
@ -10,7 +10,7 @@
|
|||||||
|
|
||||||
// ignore-pretty : (#23623) problems when ending with // comments
|
// ignore-pretty : (#23623) problems when ending with // comments
|
||||||
|
|
||||||
// error-pattern:thread 'main' panicked at 'attempted to shift left with overflow'
|
// error-pattern:thread 'main' panicked at 'attempt to shift left with overflow'
|
||||||
// compile-flags: -C debug-assertions
|
// compile-flags: -C debug-assertions
|
||||||
|
|
||||||
#![warn(exceeding_bitshifts)]
|
#![warn(exceeding_bitshifts)]
|
||||||
|
@ -10,7 +10,7 @@
|
|||||||
|
|
||||||
// ignore-pretty : (#23623) problems when ending with // comments
|
// ignore-pretty : (#23623) problems when ending with // comments
|
||||||
|
|
||||||
// error-pattern:thread 'main' panicked at 'attempted to shift left with overflow'
|
// error-pattern:thread 'main' panicked at 'attempt to shift left with overflow'
|
||||||
// compile-flags: -C debug-assertions
|
// compile-flags: -C debug-assertions
|
||||||
|
|
||||||
#![warn(exceeding_bitshifts)]
|
#![warn(exceeding_bitshifts)]
|
||||||
|
@ -10,7 +10,7 @@
|
|||||||
|
|
||||||
// ignore-pretty : (#23623) problems when ending with // comments
|
// ignore-pretty : (#23623) problems when ending with // comments
|
||||||
|
|
||||||
// error-pattern:thread 'main' panicked at 'attempted to shift left with overflow'
|
// error-pattern:thread 'main' panicked at 'attempt to shift left with overflow'
|
||||||
// compile-flags: -C debug-assertions
|
// compile-flags: -C debug-assertions
|
||||||
|
|
||||||
#![warn(exceeding_bitshifts)]
|
#![warn(exceeding_bitshifts)]
|
||||||
|
@ -10,7 +10,7 @@
|
|||||||
|
|
||||||
// ignore-pretty : (#23623) problems when ending with // comments
|
// ignore-pretty : (#23623) problems when ending with // comments
|
||||||
|
|
||||||
// error-pattern:thread 'main' panicked at 'attempted to shift left with overflow'
|
// error-pattern:thread 'main' panicked at 'attempt to shift left with overflow'
|
||||||
// compile-flags: -C debug-assertions
|
// compile-flags: -C debug-assertions
|
||||||
|
|
||||||
// This function is checking that our automatic truncation does not
|
// This function is checking that our automatic truncation does not
|
||||||
|
@ -10,7 +10,7 @@
|
|||||||
|
|
||||||
// ignore-pretty : (#23623) problems when ending with // comments
|
// ignore-pretty : (#23623) problems when ending with // comments
|
||||||
|
|
||||||
// error-pattern:thread 'main' panicked at 'attempted to multiply with overflow'
|
// error-pattern:thread 'main' panicked at 'attempt to multiply with overflow'
|
||||||
// compile-flags: -C debug-assertions
|
// compile-flags: -C debug-assertions
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
|
@ -10,7 +10,7 @@
|
|||||||
|
|
||||||
// ignore-pretty : (#23623) problems when ending with // comments
|
// ignore-pretty : (#23623) problems when ending with // comments
|
||||||
|
|
||||||
// error-pattern:thread 'main' panicked at 'attempted to negate with overflow'
|
// error-pattern:thread 'main' panicked at 'attempt to negate with overflow'
|
||||||
// compile-flags: -C debug-assertions
|
// compile-flags: -C debug-assertions
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
// option. This file may not be copied, modified, or distributed
|
// option. This file may not be copied, modified, or distributed
|
||||||
// except according to those terms.
|
// except according to those terms.
|
||||||
|
|
||||||
// error-pattern:thread 'main' panicked at 'attempted to multiply with overflow'
|
// error-pattern:thread 'main' panicked at 'attempt to multiply with overflow'
|
||||||
// compile-flags: -C debug-assertions
|
// compile-flags: -C debug-assertions
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
|
@ -10,7 +10,7 @@
|
|||||||
|
|
||||||
// ignore-pretty : (#23623) problems when ending with // comments
|
// ignore-pretty : (#23623) problems when ending with // comments
|
||||||
|
|
||||||
// error-pattern:thread 'main' panicked at 'attempted to shift right with overflow'
|
// error-pattern:thread 'main' panicked at 'attempt to shift right with overflow'
|
||||||
// compile-flags: -C debug-assertions
|
// compile-flags: -C debug-assertions
|
||||||
|
|
||||||
#![warn(exceeding_bitshifts)]
|
#![warn(exceeding_bitshifts)]
|
||||||
|
@ -10,7 +10,7 @@
|
|||||||
|
|
||||||
// ignore-pretty : (#23623) problems when ending with // comments
|
// ignore-pretty : (#23623) problems when ending with // comments
|
||||||
|
|
||||||
// error-pattern:thread 'main' panicked at 'attempted to shift right with overflow'
|
// error-pattern:thread 'main' panicked at 'attempt to shift right with overflow'
|
||||||
// compile-flags: -C debug-assertions
|
// compile-flags: -C debug-assertions
|
||||||
|
|
||||||
#![warn(exceeding_bitshifts)]
|
#![warn(exceeding_bitshifts)]
|
||||||
|
@ -10,7 +10,7 @@
|
|||||||
|
|
||||||
// ignore-pretty : (#23623) problems when ending with // comments
|
// ignore-pretty : (#23623) problems when ending with // comments
|
||||||
|
|
||||||
// error-pattern:thread 'main' panicked at 'attempted to shift right with overflow'
|
// error-pattern:thread 'main' panicked at 'attempt to shift right with overflow'
|
||||||
// compile-flags: -C debug-assertions
|
// compile-flags: -C debug-assertions
|
||||||
|
|
||||||
#![warn(exceeding_bitshifts)]
|
#![warn(exceeding_bitshifts)]
|
||||||
|
@ -10,7 +10,7 @@
|
|||||||
|
|
||||||
// ignore-pretty : (#23623) problems when ending with // comments
|
// ignore-pretty : (#23623) problems when ending with // comments
|
||||||
|
|
||||||
// error-pattern:thread 'main' panicked at 'attempted to shift right with overflow'
|
// error-pattern:thread 'main' panicked at 'attempt to shift right with overflow'
|
||||||
// compile-flags: -C debug-assertions
|
// compile-flags: -C debug-assertions
|
||||||
|
|
||||||
// This function is checking that our (type-based) automatic
|
// This function is checking that our (type-based) automatic
|
||||||
|
@ -10,7 +10,7 @@
|
|||||||
|
|
||||||
// ignore-pretty : (#23623) problems when ending with // comments
|
// ignore-pretty : (#23623) problems when ending with // comments
|
||||||
|
|
||||||
// error-pattern:thread 'main' panicked at 'attempted to shift right with overflow'
|
// error-pattern:thread 'main' panicked at 'attempt to shift right with overflow'
|
||||||
// compile-flags: -C debug-assertions
|
// compile-flags: -C debug-assertions
|
||||||
|
|
||||||
#![warn(exceeding_bitshifts)]
|
#![warn(exceeding_bitshifts)]
|
||||||
|
@ -10,7 +10,7 @@
|
|||||||
|
|
||||||
// ignore-pretty : (#23623) problems when ending with // comments
|
// ignore-pretty : (#23623) problems when ending with // comments
|
||||||
|
|
||||||
// error-pattern:thread 'main' panicked at 'attempted to shift right with overflow'
|
// error-pattern:thread 'main' panicked at 'attempt to shift right with overflow'
|
||||||
// compile-flags: -C debug-assertions
|
// compile-flags: -C debug-assertions
|
||||||
|
|
||||||
#![warn(exceeding_bitshifts)]
|
#![warn(exceeding_bitshifts)]
|
||||||
|
@ -10,7 +10,7 @@
|
|||||||
|
|
||||||
// ignore-pretty : (#23623) problems when ending with // comments
|
// ignore-pretty : (#23623) problems when ending with // comments
|
||||||
|
|
||||||
// error-pattern:thread 'main' panicked at 'attempted to subtract with overflow'
|
// error-pattern:thread 'main' panicked at 'attempt to subtract with overflow'
|
||||||
// compile-flags: -C debug-assertions
|
// compile-flags: -C debug-assertions
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
|
Loading…
Reference in New Issue
Block a user