Update wording on E0080

Change "attempted" to "attempt"
This commit is contained in:
Shantanu Raj 2016-08-04 07:31:06 +05:30
parent 9cf189701e
commit e5e4cccd3b
35 changed files with 105 additions and 105 deletions

View File

@ -23,7 +23,7 @@ code example:
#[deny(const_err)]
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
```
"##,

View File

@ -57,18 +57,18 @@ impl ConstMathErr {
UnequalTypes(BitOr) => "tried to bitor two values of different types",
UnequalTypes(BitXor) => "tried to xor two values of different types",
UnequalTypes(_) => unreachable!(),
Overflow(Add) => "attempted to add with overflow",
Overflow(Sub) => "attempted to subtract with overflow",
Overflow(Mul) => "attempted to multiply with overflow",
Overflow(Div) => "attempted to divide with overflow",
Overflow(Rem) => "attempted to calculate the remainder with overflow",
Overflow(Neg) => "attempted to negate with overflow",
Overflow(Shr) => "attempted to shift right with overflow",
Overflow(Shl) => "attempted to shift left with overflow",
Overflow(Add) => "attempt to add with overflow",
Overflow(Sub) => "attempt to subtract with overflow",
Overflow(Mul) => "attempt to multiply with overflow",
Overflow(Div) => "attempt to divide with overflow",
Overflow(Rem) => "attempt to calculate the remainder with overflow",
Overflow(Neg) => "attempt to negate with overflow",
Overflow(Shr) => "attempt to shift right with overflow",
Overflow(Shl) => "attempt to shift left with overflow",
Overflow(_) => unreachable!(),
ShiftNegative => "attempted to shift by a negative amount",
DivisionByZero => "attempted to divide by zero",
RemainderByZero => "attempted to calculate the remainder with a divisor of zero",
ShiftNegative => "attempt to shift by a negative amount",
DivisionByZero => "attempt to divide by zero",
RemainderByZero => "attempt to calculate the remainder with a divisor of zero",
UnsignedNegation => "unary negation of unsigned integer",
ULitOutOfRange(ast::UintTy::U8) => "literal out of range for u8",
ULitOutOfRange(ast::UintTy::U16) => "literal out of range for u16",

View File

@ -1512,7 +1512,7 @@ fn trans_unary<'blk, 'tcx>(bcx: Block<'blk, 'tcx>,
C_integral(llty, min, true), debug_loc);
with_cond(bcx, is_min, |bcx| {
let msg = InternedString::new(
"attempted to negate with overflow");
"attempt to negate with overflow");
controlflow::trans_fail(bcx, expr_info(expr), msg)
})
} else {

View File

@ -11,10 +11,10 @@
#![feature(const_indexing)]
#![deny(const_err)]
pub const A: i8 = -std::i8::MIN; //~ ERROR attempted to negate with overflow
pub const B: u8 = 200u8 + 200u8; //~ ERROR attempted to add with overflow
pub const C: u8 = 200u8 * 4; //~ ERROR attempted to multiply with overflow
pub const D: u8 = 42u8 - (42u8 + 1); //~ ERROR attempted to subtract with overflow
pub const A: i8 = -std::i8::MIN; //~ ERROR attempt to negate with overflow
pub const B: u8 = 200u8 + 200u8; //~ ERROR attempt to add with overflow
pub const C: u8 = 200u8 * 4; //~ ERROR attempt to multiply with overflow
pub const D: u8 = 42u8 - (42u8 + 1); //~ ERROR attempt to subtract with overflow
pub const E: u8 = [5u8][1];
//~^ ERROR index out of bounds: the len is 1 but the index is 1

View File

@ -10,7 +10,7 @@
#![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 C: u8 = A as u8;
pub const D: i8 = 50 - A;

View File

@ -30,18 +30,18 @@ const FOO: u8 = [5u8][1];
fn main() {
let a = -std::i8::MIN;
//~^ WARN this expression will panic at run-time
//~| attempted to negate with overflow
//~| attempt to negate with overflow
let b = 200u8 + 200u8 + 200u8;
//~^ 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
//~| attempted to add with overflow
//~| attempt to add with overflow
let c = 200u8 * 4;
//~^ WARN this expression will panic at run-time
//~| attempted to multiply with overflow
//~| attempt to multiply with overflow
let d = 42u8 - (42u8 + 1);
//~^ WARN this expression will panic at run-time
//~| attempted to subtract with overflow
//~| attempt to subtract with overflow
let _e = [5u8][1];
//~^ WARN this expression will panic at run-time
//~| index out of bounds: the len is 1 but the index is 1

View File

@ -18,14 +18,14 @@ fn black_box<T>(_: T) {
fn main() {
let a = -std::i8::MIN;
//~^ ERROR attempted to negate with overflow
//~^ ERROR attempt to negate with overflow
let b = 200u8 + 200u8 + 200u8;
//~^ ERROR attempted to add with overflow
//~| ERROR attempted to add with overflow
//~^ ERROR attempt to add with overflow
//~| ERROR attempt to add with overflow
let c = 200u8 * 4;
//~^ ERROR attempted to multiply with overflow
//~^ ERROR attempt to multiply with overflow
let d = 42u8 - (42u8 + 1);
//~^ ERROR attempted to subtract with overflow
//~^ ERROR attempt to subtract with overflow
let _e = [5u8][1];
black_box(a);
black_box(b);

View File

@ -20,11 +20,11 @@ use std::{u8, u16, u32, u64, usize};
const NEG_128: i8 = -128;
const NEG_NEG_128: i8 = -NEG_128;
//~^ ERROR constant evaluation error
//~| attempted to negate with overflow
//~| attempt to negate with overflow
//~| ERROR constant evaluation error
//~| attempted to negate with overflow
//~| attempt to negate with overflow
//~| ERROR constant evaluation error
//~| attempted to negate with overflow
//~| attempt to negate with overflow
fn main() {
match -128i8 {

View File

@ -17,7 +17,7 @@
// self-hosted and a cross-compiled setup; therefore resorting to
// error-pattern for now.
// error-pattern: attempted to add with overflow
// error-pattern: attempt to add with overflow
#![allow(unused_imports)]

View File

@ -23,7 +23,7 @@ use std::{u8, u16, u32, u64, usize};
const A_I8_T
: [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];
fn main() {

View File

@ -22,113 +22,113 @@ use std::{u8, u16, u32, u64, usize};
const VALS_I8: (i8, i8, i8, i8) =
(-i8::MIN,
//~^ ERROR constant evaluation error
//~| attempted to negate with overflow
//~| attempt to negate with overflow
i8::MIN - 1,
//~^ ERROR constant evaluation error
//~| attempted to subtract with overflow
//~| attempt to subtract with overflow
i8::MAX + 1,
//~^ ERROR constant evaluation error
//~| attempted to add with overflow
//~| attempt to add with overflow
i8::MIN * 2,
//~^ ERROR constant evaluation error
//~| attempted to multiply with overflow
//~| attempt to multiply with overflow
);
const VALS_I16: (i16, i16, i16, i16) =
(-i16::MIN,
//~^ ERROR constant evaluation error
//~| attempted to negate with overflow
//~| attempt to negate with overflow
i16::MIN - 1,
//~^ ERROR constant evaluation error
//~| attempted to subtract with overflow
//~| attempt to subtract with overflow
i16::MAX + 1,
//~^ ERROR constant evaluation error
//~| attempted to add with overflow
//~| attempt to add with overflow
i16::MIN * 2,
//~^ ERROR constant evaluation error
//~| attempted to multiply with overflow
//~| attempt to multiply with overflow
);
const VALS_I32: (i32, i32, i32, i32) =
(-i32::MIN,
//~^ ERROR constant evaluation error
//~| attempted to negate with overflow
//~| attempt to negate with overflow
i32::MIN - 1,
//~^ ERROR constant evaluation error
//~| attempted to subtract with overflow
//~| attempt to subtract with overflow
i32::MAX + 1,
//~^ ERROR constant evaluation error
//~| attempted to add with overflow
//~| attempt to add with overflow
i32::MIN * 2,
//~^ ERROR constant evaluation error
//~| attempted to multiply with overflow
//~| attempt to multiply with overflow
);
const VALS_I64: (i64, i64, i64, i64) =
(-i64::MIN,
//~^ ERROR constant evaluation error
//~| attempted to negate with overflow
//~| attempt to negate with overflow
i64::MIN - 1,
//~^ ERROR constant evaluation error
//~| attempted to subtract with overflow
//~| attempt to subtract with overflow
i64::MAX + 1,
//~^ ERROR constant evaluation error
//~| attempted to add with overflow
//~| attempt to add with overflow
i64::MAX * 2,
//~^ ERROR constant evaluation error
//~| attempted to multiply with overflow
//~| attempt to multiply with overflow
);
const VALS_U8: (u8, u8, u8, u8) =
(-(u8::MIN as i8) as u8,
u8::MIN - 1,
//~^ ERROR constant evaluation error
//~| attempted to subtract with overflow
//~| attempt to subtract with overflow
u8::MAX + 1,
//~^ ERROR constant evaluation error
//~| attempted to add with overflow
//~| attempt to add with overflow
u8::MAX * 2,
//~^ ERROR constant evaluation error
//~| attempted to multiply with overflow
//~| attempt to multiply with overflow
);
const VALS_U16: (u16, u16, u16, u16) =
(-(u16::MIN as i16) as u16,
u16::MIN - 1,
//~^ ERROR constant evaluation error
//~| attempted to subtract with overflow
//~| attempt to subtract with overflow
u16::MAX + 1,
//~^ ERROR constant evaluation error
//~| attempted to add with overflow
//~| attempt to add with overflow
u16::MAX * 2,
//~^ ERROR constant evaluation error
//~| attempted to multiply with overflow
//~| attempt to multiply with overflow
);
const VALS_U32: (u32, u32, u32, u32) =
(-(u32::MIN as i32) as u32,
u32::MIN - 1,
//~^ ERROR constant evaluation error
//~| attempted to subtract with overflow
//~| attempt to subtract with overflow
u32::MAX + 1,
//~^ ERROR constant evaluation error
//~| attempted to add with overflow
//~| attempt to add with overflow
u32::MAX * 2,
//~^ ERROR constant evaluation error
//~| attempted to multiply with overflow
//~| attempt to multiply with overflow
);
const VALS_U64: (u64, u64, u64, u64) =
(-(u64::MIN as i64) as u64,
u64::MIN - 1,
//~^ ERROR constant evaluation error
//~| attempted to subtract with overflow
//~| attempt to subtract with overflow
u64::MAX + 1,
//~^ ERROR constant evaluation error
//~| attempted to add with overflow
//~| attempt to add with overflow
u64::MAX * 2,
//~^ ERROR constant evaluation error
//~| attempted to multiply with overflow
//~| attempt to multiply with overflow
);
fn main() {

View File

@ -16,7 +16,7 @@ const ONE: usize = 1;
const TWO: usize = 2;
const LEN: usize = ONE - TWO;
//~^ ERROR E0080
//~| attempted to subtract with overflow
//~| attempt to subtract with overflow
fn main() {
let a: [i8; LEN] = unimplemented!();

View File

@ -17,5 +17,5 @@ const TWO: usize = 2;
fn main() {
let a: [i8; ONE - TWO] = unimplemented!();
//~^ ERROR constant evaluation error [E0080]
//~| attempted to subtract with overflow
//~| attempt to subtract with overflow
}

View File

@ -12,7 +12,7 @@
const TUP: (usize,) = 5 << 64;
//~^ ERROR E0080
//~| attempted to shift left with overflow
//~| attempt to shift left with overflow
const ARR: [i32; TUP.0] = [];
fn main() {

View File

@ -10,10 +10,10 @@
enum test {
div_zero = 1/0, //~ ERROR E0080
//~| attempted to divide by zero
//~| attempt to divide by zero
rem_zero = 1%0,
//~^ ERROR E0080
//~| attempted to calculate the remainder with a divisor of zero
//~| attempt to calculate the remainder with a divisor of zero
}
fn main() {}

View File

@ -15,43 +15,43 @@ use std::thread;
fn main() {
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());
//~^ ERROR attempted to divide with overflow
//~^ ERROR attempt to divide with overflow
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());
//~^ ERROR attempted to divide with overflow
//~^ ERROR attempt to divide with overflow
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());
//~^ ERROR attempted to divide by zero
//~^ ERROR attempt to divide by zero
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());
//~^ ERROR attempted to divide by zero
//~^ ERROR attempt to divide by zero
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());
//~^ ERROR attempted to divide by zero
//~^ ERROR attempt to divide by zero
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());
//~^ 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());
//~^ 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());
//~^ 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());
//~^ 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());
//~^ 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());
//~^ 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());
//~^ 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());
//~^ 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());
//~^ ERROR attempted to calculate the remainder with a divisor of zero
//~^ ERROR attempt to calculate the remainder with a divisor of zero
}

View File

@ -53,7 +53,7 @@ fn main() {
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
//~^ 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+4); //~ ERROR: bitshift exceeds the type's number of bits

View File

@ -15,7 +15,7 @@
#[allow(unused_variables)]
fn main() {
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

View File

@ -10,7 +10,7 @@
// ignore-pretty : (#23623) problems when ending with // comments
// error-pattern:attempted to divide by zero
// error-pattern:attempt to divide by zero
fn main() {
let y = 0;

View File

@ -10,7 +10,7 @@
// 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() {
let y = 0;

View File

@ -10,7 +10,7 @@
// 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

View File

@ -10,7 +10,7 @@
// 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
#![warn(exceeding_bitshifts)]

View File

@ -10,7 +10,7 @@
// 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
#![warn(exceeding_bitshifts)]

View File

@ -10,7 +10,7 @@
// 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
#![warn(exceeding_bitshifts)]

View File

@ -10,7 +10,7 @@
// 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
// This function is checking that our automatic truncation does not

View File

@ -10,7 +10,7 @@
// 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
fn main() {

View File

@ -10,7 +10,7 @@
// 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
fn main() {

View File

@ -8,7 +8,7 @@
// option. This file may not be copied, modified, or distributed
// 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
fn main() {

View File

@ -10,7 +10,7 @@
// 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
#![warn(exceeding_bitshifts)]

View File

@ -10,7 +10,7 @@
// 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
#![warn(exceeding_bitshifts)]

View File

@ -10,7 +10,7 @@
// 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
#![warn(exceeding_bitshifts)]

View File

@ -10,7 +10,7 @@
// 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
// This function is checking that our (type-based) automatic

View File

@ -10,7 +10,7 @@
// 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
#![warn(exceeding_bitshifts)]

View File

@ -10,7 +10,7 @@
// 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
#![warn(exceeding_bitshifts)]

View File

@ -10,7 +10,7 @@
// 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
fn main() {