Skip to content

Commit d2a1b80

Browse files
committed
Add stderrs with duplicate diagnostics.
1 parent 73fd75f commit d2a1b80

5 files changed

+153
-3
lines changed
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
error: this arithmetic operation will overflow
2+
--> $DIR/lints-used-unused.rs:16:20
3+
|
4+
LL | const N: i32 = 1 << 42;
5+
| ^^^^^^^ attempt to shift left with overflow
6+
|
7+
note: the lint level is defined here
8+
--> $DIR/lints-used-unused.rs:7:9
9+
|
10+
LL | #![deny(arithmetic_overflow)]
11+
| ^^^^^^^^^^^^^^^^^^^
12+
13+
error: any use of this value will cause an error
14+
--> $DIR/lints-used-unused.rs:16:20
15+
|
16+
LL | const N: i32 = 1 << 42;
17+
| ---------------^^^^^^^-
18+
| |
19+
| attempt to shift left with overflow
20+
|
21+
= note: `#[deny(const_err)]` on by default
22+
23+
error: aborting due to 2 previous errors
24+
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
error: this arithmetic operation will overflow
2+
--> $DIR/lints-used-unused.rs:16:20
3+
|
4+
LL | const N: i32 = 1 << 42;
5+
| ^^^^^^^ attempt to shift left with overflow
6+
|
7+
note: the lint level is defined here
8+
--> $DIR/lints-used-unused.rs:7:9
9+
|
10+
LL | #![deny(arithmetic_overflow)]
11+
| ^^^^^^^^^^^^^^^^^^^
12+
13+
error: any use of this value will cause an error
14+
--> $DIR/lints-used-unused.rs:16:20
15+
|
16+
LL | const N: i32 = 1 << 42;
17+
| ---------------^^^^^^^-
18+
| |
19+
| attempt to shift left with overflow
20+
|
21+
= note: `#[deny(const_err)]` on by default
22+
23+
error: aborting due to 2 previous errors
24+

src/test/ui/consts/issue-69020.noopt.stderr

Lines changed: 35 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,30 @@ LL | const NEG: i32 = -i32::MIN + T::NEG;
66
|
77
= note: `#[deny(arithmetic_overflow)]` on by default
88

9+
error: any use of this value will cause an error
10+
--> $DIR/issue-69020.rs:21:22
11+
|
12+
LL | const NEG: i32 = -i32::MIN + T::NEG;
13+
| -----------------^^^^^^^^^----------
14+
| |
15+
| attempt to negate with overflow
16+
|
17+
= note: `#[deny(const_err)]` on by default
18+
919
error: this arithmetic operation will overflow
1020
--> $DIR/issue-69020.rs:23:22
1121
|
1222
LL | const ADD: i32 = (i32::MAX+1) + T::ADD;
1323
| ^^^^^^^^^^^^ attempt to add with overflow
1424

25+
error: any use of this value will cause an error
26+
--> $DIR/issue-69020.rs:23:22
27+
|
28+
LL | const ADD: i32 = (i32::MAX+1) + T::ADD;
29+
| -----------------^^^^^^^^^^^^----------
30+
| |
31+
| attempt to add with overflow
32+
1533
error: this operation will panic at runtime
1634
--> $DIR/issue-69020.rs:25:22
1735
|
@@ -20,11 +38,27 @@ LL | const DIV: i32 = (1/0) + T::DIV;
2038
|
2139
= note: `#[deny(unconditional_panic)]` on by default
2240

41+
error: any use of this value will cause an error
42+
--> $DIR/issue-69020.rs:25:22
43+
|
44+
LL | const DIV: i32 = (1/0) + T::DIV;
45+
| -----------------^^^^^----------
46+
| |
47+
| attempt to divide by zero
48+
2349
error: this operation will panic at runtime
2450
--> $DIR/issue-69020.rs:27:22
2551
|
2652
LL | const OOB: i32 = [1][1] + T::OOB;
2753
| ^^^^^^ index out of bounds: the len is 1 but the index is 1
2854

29-
error: aborting due to 4 previous errors
55+
error: any use of this value will cause an error
56+
--> $DIR/issue-69020.rs:27:22
57+
|
58+
LL | const OOB: i32 = [1][1] + T::OOB;
59+
| -----------------^^^^^^----------
60+
| |
61+
| index out of bounds: the len is 1 but the index is 1
62+
63+
error: aborting due to 8 previous errors
3064

src/test/ui/consts/issue-69020.opt.stderr

Lines changed: 35 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,30 @@ LL | const NEG: i32 = -i32::MIN + T::NEG;
66
|
77
= note: `#[deny(arithmetic_overflow)]` on by default
88

9+
error: any use of this value will cause an error
10+
--> $DIR/issue-69020.rs:21:22
11+
|
12+
LL | const NEG: i32 = -i32::MIN + T::NEG;
13+
| -----------------^^^^^^^^^----------
14+
| |
15+
| attempt to negate with overflow
16+
|
17+
= note: `#[deny(const_err)]` on by default
18+
919
error: this arithmetic operation will overflow
1020
--> $DIR/issue-69020.rs:23:22
1121
|
1222
LL | const ADD: i32 = (i32::MAX+1) + T::ADD;
1323
| ^^^^^^^^^^^^ attempt to add with overflow
1424

25+
error: any use of this value will cause an error
26+
--> $DIR/issue-69020.rs:23:22
27+
|
28+
LL | const ADD: i32 = (i32::MAX+1) + T::ADD;
29+
| -----------------^^^^^^^^^^^^----------
30+
| |
31+
| attempt to add with overflow
32+
1533
error: this operation will panic at runtime
1634
--> $DIR/issue-69020.rs:25:22
1735
|
@@ -20,11 +38,27 @@ LL | const DIV: i32 = (1/0) + T::DIV;
2038
|
2139
= note: `#[deny(unconditional_panic)]` on by default
2240

41+
error: any use of this value will cause an error
42+
--> $DIR/issue-69020.rs:25:22
43+
|
44+
LL | const DIV: i32 = (1/0) + T::DIV;
45+
| -----------------^^^^^----------
46+
| |
47+
| attempt to divide by zero
48+
2349
error: this operation will panic at runtime
2450
--> $DIR/issue-69020.rs:27:22
2551
|
2652
LL | const OOB: i32 = [1][1] + T::OOB;
2753
| ^^^^^^ index out of bounds: the len is 1 but the index is 1
2854

29-
error: aborting due to 4 previous errors
55+
error: any use of this value will cause an error
56+
--> $DIR/issue-69020.rs:27:22
57+
|
58+
LL | const OOB: i32 = [1][1] + T::OOB;
59+
| -----------------^^^^^^----------
60+
| |
61+
| index out of bounds: the len is 1 but the index is 1
62+
63+
error: aborting due to 8 previous errors
3064

src/test/ui/consts/issue-69020.opt_with_overflow_checks.stderr

Lines changed: 35 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,30 @@ LL | const NEG: i32 = -i32::MIN + T::NEG;
66
|
77
= note: `#[deny(arithmetic_overflow)]` on by default
88

9+
error: any use of this value will cause an error
10+
--> $DIR/issue-69020.rs:21:22
11+
|
12+
LL | const NEG: i32 = -i32::MIN + T::NEG;
13+
| -----------------^^^^^^^^^----------
14+
| |
15+
| attempt to negate with overflow
16+
|
17+
= note: `#[deny(const_err)]` on by default
18+
919
error: this arithmetic operation will overflow
1020
--> $DIR/issue-69020.rs:23:22
1121
|
1222
LL | const ADD: i32 = (i32::MAX+1) + T::ADD;
1323
| ^^^^^^^^^^^^ attempt to add with overflow
1424

25+
error: any use of this value will cause an error
26+
--> $DIR/issue-69020.rs:23:22
27+
|
28+
LL | const ADD: i32 = (i32::MAX+1) + T::ADD;
29+
| -----------------^^^^^^^^^^^^----------
30+
| |
31+
| attempt to add with overflow
32+
1533
error: this operation will panic at runtime
1634
--> $DIR/issue-69020.rs:25:22
1735
|
@@ -20,11 +38,27 @@ LL | const DIV: i32 = (1/0) + T::DIV;
2038
|
2139
= note: `#[deny(unconditional_panic)]` on by default
2240

41+
error: any use of this value will cause an error
42+
--> $DIR/issue-69020.rs:25:22
43+
|
44+
LL | const DIV: i32 = (1/0) + T::DIV;
45+
| -----------------^^^^^----------
46+
| |
47+
| attempt to divide by zero
48+
2349
error: this operation will panic at runtime
2450
--> $DIR/issue-69020.rs:27:22
2551
|
2652
LL | const OOB: i32 = [1][1] + T::OOB;
2753
| ^^^^^^ index out of bounds: the len is 1 but the index is 1
2854

29-
error: aborting due to 4 previous errors
55+
error: any use of this value will cause an error
56+
--> $DIR/issue-69020.rs:27:22
57+
|
58+
LL | const OOB: i32 = [1][1] + T::OOB;
59+
| -----------------^^^^^^----------
60+
| |
61+
| index out of bounds: the len is 1 but the index is 1
62+
63+
error: aborting due to 8 previous errors
3064

0 commit comments

Comments
 (0)