Skip to content

Commit 41fe4b7

Browse files
authored
Auto merge of #35283 - shantanuraj:master, r=jonathandturner
Update wording on E0080 Part of #35223 Update wording on error E0080. Change "attempted" to "attempt" r? @GuillaumeGomez
2 parents 802d081 + e5e4ccc commit 41fe4b7

35 files changed

+105
-105
lines changed

src/librustc/diagnostics.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ code example:
2323
#[deny(const_err)]
2424
2525
const X: i32 = 42 / 0;
26-
// error: attempted to divide by zero in a constant expression
26+
// error: attempt to divide by zero in a constant expression
2727
```
2828
"##,
2929

src/librustc_const_math/err.rs

+11-11
Original file line numberDiff line numberDiff line change
@@ -57,18 +57,18 @@ impl ConstMathErr {
5757
UnequalTypes(BitOr) => "tried to bitor two values of different types",
5858
UnequalTypes(BitXor) => "tried to xor two values of different types",
5959
UnequalTypes(_) => unreachable!(),
60-
Overflow(Add) => "attempted to add with overflow",
61-
Overflow(Sub) => "attempted to subtract with overflow",
62-
Overflow(Mul) => "attempted to multiply with overflow",
63-
Overflow(Div) => "attempted to divide with overflow",
64-
Overflow(Rem) => "attempted to calculate the remainder with overflow",
65-
Overflow(Neg) => "attempted to negate with overflow",
66-
Overflow(Shr) => "attempted to shift right with overflow",
67-
Overflow(Shl) => "attempted to shift left with overflow",
60+
Overflow(Add) => "attempt to add with overflow",
61+
Overflow(Sub) => "attempt to subtract with overflow",
62+
Overflow(Mul) => "attempt to multiply with overflow",
63+
Overflow(Div) => "attempt to divide with overflow",
64+
Overflow(Rem) => "attempt to calculate the remainder with overflow",
65+
Overflow(Neg) => "attempt to negate with overflow",
66+
Overflow(Shr) => "attempt to shift right with overflow",
67+
Overflow(Shl) => "attempt to shift left with overflow",
6868
Overflow(_) => unreachable!(),
69-
ShiftNegative => "attempted to shift by a negative amount",
70-
DivisionByZero => "attempted to divide by zero",
71-
RemainderByZero => "attempted to calculate the remainder with a divisor of zero",
69+
ShiftNegative => "attempt to shift by a negative amount",
70+
DivisionByZero => "attempt to divide by zero",
71+
RemainderByZero => "attempt to calculate the remainder with a divisor of zero",
7272
UnsignedNegation => "unary negation of unsigned integer",
7373
ULitOutOfRange(ast::UintTy::U8) => "literal out of range for u8",
7474
ULitOutOfRange(ast::UintTy::U16) => "literal out of range for u16",

src/librustc_trans/expr.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1512,7 +1512,7 @@ fn trans_unary<'blk, 'tcx>(bcx: Block<'blk, 'tcx>,
15121512
C_integral(llty, min, true), debug_loc);
15131513
with_cond(bcx, is_min, |bcx| {
15141514
let msg = InternedString::new(
1515-
"attempted to negate with overflow");
1515+
"attempt to negate with overflow");
15161516
controlflow::trans_fail(bcx, expr_info(expr), msg)
15171517
})
15181518
} else {

src/test/compile-fail/const-err-early.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,10 @@
1111
#![feature(const_indexing)]
1212
#![deny(const_err)]
1313

14-
pub const A: i8 = -std::i8::MIN; //~ ERROR attempted to negate with overflow
15-
pub const B: u8 = 200u8 + 200u8; //~ ERROR attempted to add with overflow
16-
pub const C: u8 = 200u8 * 4; //~ ERROR attempted to multiply with overflow
17-
pub const D: u8 = 42u8 - (42u8 + 1); //~ ERROR attempted to subtract with overflow
14+
pub const A: i8 = -std::i8::MIN; //~ ERROR attempt to negate with overflow
15+
pub const B: u8 = 200u8 + 200u8; //~ ERROR attempt to add with overflow
16+
pub const C: u8 = 200u8 * 4; //~ ERROR attempt to multiply with overflow
17+
pub const D: u8 = 42u8 - (42u8 + 1); //~ ERROR attempt to subtract with overflow
1818
pub const E: u8 = [5u8][1];
1919
//~^ ERROR index out of bounds: the len is 1 but the index is 1
2020

src/test/compile-fail/const-err-multi.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
#![deny(const_err)]
1212

13-
pub const A: i8 = -std::i8::MIN; //~ ERROR attempted to negate with overflow
13+
pub const A: i8 = -std::i8::MIN; //~ ERROR attempt to negate with overflow
1414
pub const B: i8 = A;
1515
pub const C: u8 = A as u8;
1616
pub const D: i8 = 50 - A;

src/test/compile-fail/const-err.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -30,18 +30,18 @@ const FOO: u8 = [5u8][1];
3030
fn main() {
3131
let a = -std::i8::MIN;
3232
//~^ WARN this expression will panic at run-time
33-
//~| attempted to negate with overflow
33+
//~| attempt to negate with overflow
3434
let b = 200u8 + 200u8 + 200u8;
3535
//~^ WARN this expression will panic at run-time
36-
//~| attempted to add with overflow
36+
//~| attempt to add with overflow
3737
//~^^^ WARN this expression will panic at run-time
38-
//~| attempted to add with overflow
38+
//~| attempt to add with overflow
3939
let c = 200u8 * 4;
4040
//~^ WARN this expression will panic at run-time
41-
//~| attempted to multiply with overflow
41+
//~| attempt to multiply with overflow
4242
let d = 42u8 - (42u8 + 1);
4343
//~^ WARN this expression will panic at run-time
44-
//~| attempted to subtract with overflow
44+
//~| attempt to subtract with overflow
4545
let _e = [5u8][1];
4646
//~^ WARN this expression will panic at run-time
4747
//~| index out of bounds: the len is 1 but the index is 1

src/test/compile-fail/const-err2.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,14 @@ fn black_box<T>(_: T) {
1818

1919
fn main() {
2020
let a = -std::i8::MIN;
21-
//~^ ERROR attempted to negate with overflow
21+
//~^ ERROR attempt to negate with overflow
2222
let b = 200u8 + 200u8 + 200u8;
23-
//~^ ERROR attempted to add with overflow
24-
//~| ERROR attempted to add with overflow
23+
//~^ ERROR attempt to add with overflow
24+
//~| ERROR attempt to add with overflow
2525
let c = 200u8 * 4;
26-
//~^ ERROR attempted to multiply with overflow
26+
//~^ ERROR attempt to multiply with overflow
2727
let d = 42u8 - (42u8 + 1);
28-
//~^ ERROR attempted to subtract with overflow
28+
//~^ ERROR attempt to subtract with overflow
2929
let _e = [5u8][1];
3030
black_box(a);
3131
black_box(b);

src/test/compile-fail/const-eval-overflow-2.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,11 @@ use std::{u8, u16, u32, u64, usize};
2020
const NEG_128: i8 = -128;
2121
const NEG_NEG_128: i8 = -NEG_128;
2222
//~^ ERROR constant evaluation error
23-
//~| attempted to negate with overflow
23+
//~| attempt to negate with overflow
2424
//~| ERROR constant evaluation error
25-
//~| attempted to negate with overflow
25+
//~| attempt to negate with overflow
2626
//~| ERROR constant evaluation error
27-
//~| attempted to negate with overflow
27+
//~| attempt to negate with overflow
2828

2929
fn main() {
3030
match -128i8 {

src/test/compile-fail/const-eval-overflow-3.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
// self-hosted and a cross-compiled setup; therefore resorting to
1818
// error-pattern for now.
1919

20-
// error-pattern: attempted to add with overflow
20+
// error-pattern: attempt to add with overflow
2121

2222
#![allow(unused_imports)]
2323

src/test/compile-fail/const-eval-overflow-4.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ use std::{u8, u16, u32, u64, usize};
2323

2424
const A_I8_T
2525
: [u32; (i8::MAX as i8 + 1i8) as usize]
26-
//~^ ERROR error evaluating count: attempted to add with overflow
26+
//~^ ERROR error evaluating count: attempt to add with overflow
2727
= [0; (i8::MAX as usize) + 1];
2828

2929
fn main() {

src/test/compile-fail/const-eval-overflow.rs

+28-28
Original file line numberDiff line numberDiff line change
@@ -22,113 +22,113 @@ use std::{u8, u16, u32, u64, usize};
2222
const VALS_I8: (i8, i8, i8, i8) =
2323
(-i8::MIN,
2424
//~^ ERROR constant evaluation error
25-
//~| attempted to negate with overflow
25+
//~| attempt to negate with overflow
2626
i8::MIN - 1,
2727
//~^ ERROR constant evaluation error
28-
//~| attempted to subtract with overflow
28+
//~| attempt to subtract with overflow
2929
i8::MAX + 1,
3030
//~^ ERROR constant evaluation error
31-
//~| attempted to add with overflow
31+
//~| attempt to add with overflow
3232
i8::MIN * 2,
3333
//~^ ERROR constant evaluation error
34-
//~| attempted to multiply with overflow
34+
//~| attempt to multiply with overflow
3535
);
3636

3737
const VALS_I16: (i16, i16, i16, i16) =
3838
(-i16::MIN,
3939
//~^ ERROR constant evaluation error
40-
//~| attempted to negate with overflow
40+
//~| attempt to negate with overflow
4141
i16::MIN - 1,
4242
//~^ ERROR constant evaluation error
43-
//~| attempted to subtract with overflow
43+
//~| attempt to subtract with overflow
4444
i16::MAX + 1,
4545
//~^ ERROR constant evaluation error
46-
//~| attempted to add with overflow
46+
//~| attempt to add with overflow
4747
i16::MIN * 2,
4848
//~^ ERROR constant evaluation error
49-
//~| attempted to multiply with overflow
49+
//~| attempt to multiply with overflow
5050
);
5151

5252
const VALS_I32: (i32, i32, i32, i32) =
5353
(-i32::MIN,
5454
//~^ ERROR constant evaluation error
55-
//~| attempted to negate with overflow
55+
//~| attempt to negate with overflow
5656
i32::MIN - 1,
5757
//~^ ERROR constant evaluation error
58-
//~| attempted to subtract with overflow
58+
//~| attempt to subtract with overflow
5959
i32::MAX + 1,
6060
//~^ ERROR constant evaluation error
61-
//~| attempted to add with overflow
61+
//~| attempt to add with overflow
6262
i32::MIN * 2,
6363
//~^ ERROR constant evaluation error
64-
//~| attempted to multiply with overflow
64+
//~| attempt to multiply with overflow
6565
);
6666

6767
const VALS_I64: (i64, i64, i64, i64) =
6868
(-i64::MIN,
6969
//~^ ERROR constant evaluation error
70-
//~| attempted to negate with overflow
70+
//~| attempt to negate with overflow
7171
i64::MIN - 1,
7272
//~^ ERROR constant evaluation error
73-
//~| attempted to subtract with overflow
73+
//~| attempt to subtract with overflow
7474
i64::MAX + 1,
7575
//~^ ERROR constant evaluation error
76-
//~| attempted to add with overflow
76+
//~| attempt to add with overflow
7777
i64::MAX * 2,
7878
//~^ ERROR constant evaluation error
79-
//~| attempted to multiply with overflow
79+
//~| attempt to multiply with overflow
8080
);
8181

8282
const VALS_U8: (u8, u8, u8, u8) =
8383
(-(u8::MIN as i8) as u8,
8484
u8::MIN - 1,
8585
//~^ ERROR constant evaluation error
86-
//~| attempted to subtract with overflow
86+
//~| attempt to subtract with overflow
8787
u8::MAX + 1,
8888
//~^ ERROR constant evaluation error
89-
//~| attempted to add with overflow
89+
//~| attempt to add with overflow
9090
u8::MAX * 2,
9191
//~^ ERROR constant evaluation error
92-
//~| attempted to multiply with overflow
92+
//~| attempt to multiply with overflow
9393
);
9494

9595
const VALS_U16: (u16, u16, u16, u16) =
9696
(-(u16::MIN as i16) as u16,
9797
u16::MIN - 1,
9898
//~^ ERROR constant evaluation error
99-
//~| attempted to subtract with overflow
99+
//~| attempt to subtract with overflow
100100
u16::MAX + 1,
101101
//~^ ERROR constant evaluation error
102-
//~| attempted to add with overflow
102+
//~| attempt to add with overflow
103103
u16::MAX * 2,
104104
//~^ ERROR constant evaluation error
105-
//~| attempted to multiply with overflow
105+
//~| attempt to multiply with overflow
106106
);
107107

108108
const VALS_U32: (u32, u32, u32, u32) =
109109
(-(u32::MIN as i32) as u32,
110110
u32::MIN - 1,
111111
//~^ ERROR constant evaluation error
112-
//~| attempted to subtract with overflow
112+
//~| attempt to subtract with overflow
113113
u32::MAX + 1,
114114
//~^ ERROR constant evaluation error
115-
//~| attempted to add with overflow
115+
//~| attempt to add with overflow
116116
u32::MAX * 2,
117117
//~^ ERROR constant evaluation error
118-
//~| attempted to multiply with overflow
118+
//~| attempt to multiply with overflow
119119
);
120120

121121
const VALS_U64: (u64, u64, u64, u64) =
122122
(-(u64::MIN as i64) as u64,
123123
u64::MIN - 1,
124124
//~^ ERROR constant evaluation error
125-
//~| attempted to subtract with overflow
125+
//~| attempt to subtract with overflow
126126
u64::MAX + 1,
127127
//~^ ERROR constant evaluation error
128-
//~| attempted to add with overflow
128+
//~| attempt to add with overflow
129129
u64::MAX * 2,
130130
//~^ ERROR constant evaluation error
131-
//~| attempted to multiply with overflow
131+
//~| attempt to multiply with overflow
132132
);
133133

134134
fn main() {

src/test/compile-fail/const-len-underflow-separate-spans.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ const ONE: usize = 1;
1616
const TWO: usize = 2;
1717
const LEN: usize = ONE - TWO;
1818
//~^ ERROR E0080
19-
//~| attempted to subtract with overflow
19+
//~| attempt to subtract with overflow
2020

2121
fn main() {
2222
let a: [i8; LEN] = unimplemented!();

src/test/compile-fail/const-len-underflow-subspans.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,5 +17,5 @@ const TWO: usize = 2;
1717
fn main() {
1818
let a: [i8; ONE - TWO] = unimplemented!();
1919
//~^ ERROR constant evaluation error [E0080]
20-
//~| attempted to subtract with overflow
20+
//~| attempt to subtract with overflow
2121
}

src/test/compile-fail/const-tup-index-span.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
const TUP: (usize,) = 5 << 64;
1414
//~^ ERROR E0080
15-
//~| attempted to shift left with overflow
15+
//~| attempt to shift left with overflow
1616
const ARR: [i32; TUP.0] = [];
1717

1818
fn main() {

src/test/compile-fail/eval-enum.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@
1010

1111
enum test {
1212
div_zero = 1/0, //~ ERROR E0080
13-
//~| attempted to divide by zero
13+
//~| attempt to divide by zero
1414
rem_zero = 1%0,
1515
//~^ ERROR E0080
16-
//~| attempted to calculate the remainder with a divisor of zero
16+
//~| attempt to calculate the remainder with a divisor of zero
1717
}
1818

1919
fn main() {}

src/test/compile-fail/issue-8460-const.rs

+20-20
Original file line numberDiff line numberDiff line change
@@ -15,43 +15,43 @@ use std::thread;
1515

1616
fn main() {
1717
assert!(thread::spawn(move|| { isize::MIN / -1; }).join().is_err());
18-
//~^ ERROR attempted to divide with overflow
18+
//~^ ERROR attempt to divide with overflow
1919
assert!(thread::spawn(move|| { i8::MIN / -1; }).join().is_err());
20-
//~^ ERROR attempted to divide with overflow
20+
//~^ ERROR attempt to divide with overflow
2121
assert!(thread::spawn(move|| { i16::MIN / -1; }).join().is_err());
22-
//~^ ERROR attempted to divide with overflow
22+
//~^ ERROR attempt to divide with overflow
2323
assert!(thread::spawn(move|| { i32::MIN / -1; }).join().is_err());
24-
//~^ ERROR attempted to divide with overflow
24+
//~^ ERROR attempt to divide with overflow
2525
assert!(thread::spawn(move|| { i64::MIN / -1; }).join().is_err());
26-
//~^ ERROR attempted to divide with overflow
26+
//~^ ERROR attempt to divide with overflow
2727
assert!(thread::spawn(move|| { 1isize / 0; }).join().is_err());
28-
//~^ ERROR attempted to divide by zero
28+
//~^ ERROR attempt to divide by zero
2929
assert!(thread::spawn(move|| { 1i8 / 0; }).join().is_err());
30-
//~^ ERROR attempted to divide by zero
30+
//~^ ERROR attempt to divide by zero
3131
assert!(thread::spawn(move|| { 1i16 / 0; }).join().is_err());
32-
//~^ ERROR attempted to divide by zero
32+
//~^ ERROR attempt to divide by zero
3333
assert!(thread::spawn(move|| { 1i32 / 0; }).join().is_err());
34-
//~^ ERROR attempted to divide by zero
34+
//~^ ERROR attempt to divide by zero
3535
assert!(thread::spawn(move|| { 1i64 / 0; }).join().is_err());
36-
//~^ ERROR attempted to divide by zero
36+
//~^ ERROR attempt to divide by zero
3737
assert!(thread::spawn(move|| { isize::MIN % -1; }).join().is_err());
38-
//~^ ERROR attempted to calculate the remainder with overflow
38+
//~^ ERROR attempt to calculate the remainder with overflow
3939
assert!(thread::spawn(move|| { i8::MIN % -1; }).join().is_err());
40-
//~^ ERROR attempted to calculate the remainder with overflow
40+
//~^ ERROR attempt to calculate the remainder with overflow
4141
assert!(thread::spawn(move|| { i16::MIN % -1; }).join().is_err());
42-
//~^ ERROR attempted to calculate the remainder with overflow
42+
//~^ ERROR attempt to calculate the remainder with overflow
4343
assert!(thread::spawn(move|| { i32::MIN % -1; }).join().is_err());
44-
//~^ ERROR attempted to calculate the remainder with overflow
44+
//~^ ERROR attempt to calculate the remainder with overflow
4545
assert!(thread::spawn(move|| { i64::MIN % -1; }).join().is_err());
46-
//~^ ERROR attempted to calculate the remainder with overflow
46+
//~^ ERROR attempt to calculate the remainder with overflow
4747
assert!(thread::spawn(move|| { 1isize % 0; }).join().is_err());
48-
//~^ ERROR attempted to calculate the remainder with a divisor of zero
48+
//~^ ERROR attempt to calculate the remainder with a divisor of zero
4949
assert!(thread::spawn(move|| { 1i8 % 0; }).join().is_err());
50-
//~^ ERROR attempted to calculate the remainder with a divisor of zero
50+
//~^ ERROR attempt to calculate the remainder with a divisor of zero
5151
assert!(thread::spawn(move|| { 1i16 % 0; }).join().is_err());
52-
//~^ ERROR attempted to calculate the remainder with a divisor of zero
52+
//~^ ERROR attempt to calculate the remainder with a divisor of zero
5353
assert!(thread::spawn(move|| { 1i32 % 0; }).join().is_err());
54-
//~^ ERROR attempted to calculate the remainder with a divisor of zero
54+
//~^ ERROR attempt to calculate the remainder with a divisor of zero
5555
assert!(thread::spawn(move|| { 1i64 % 0; }).join().is_err());
56-
//~^ ERROR attempted to calculate the remainder with a divisor of zero
56+
//~^ ERROR attempt to calculate the remainder with a divisor of zero
5757
}

0 commit comments

Comments
 (0)