Skip to content

Commit 0d73bb9

Browse files
committed
Extend #69020 test to include reversed order.
Make sure we check the case where the generic operand comes first, in case any future changes make this ordering matter.
1 parent 0f72ce1 commit 0d73bb9

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

src/test/ui/consts/issue-69020.rs

+18
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,16 @@ use std::i32;
99

1010
pub trait Foo {
1111
const NEG: i32;
12+
const GEN: i32;
13+
1214
const ADD: i32;
15+
const DDA: i32;
16+
1317
const DIV: i32;
18+
const VID: i32;
19+
1420
const OOB: i32;
21+
const BOO: i32;
1522
}
1623

1724
// These constants cannot be evaluated already (they depend on `T::N`), so
@@ -20,10 +27,21 @@ pub trait Foo {
2027
impl<T: Foo> Foo for Vec<T> {
2128
const NEG: i32 = -i32::MIN + T::NEG;
2229
//~^ ERROR arithmetic operation will overflow
30+
const GEN: i32 = T::NEG + (-i32::MIN);
31+
//~^ ERROR arithmetic operation will overflow
32+
2333
const ADD: i32 = (i32::MAX+1) + T::ADD;
2434
//~^ ERROR arithmetic operation will overflow
35+
const DDA: i32 = T::ADD + (i32::MAX+1);
36+
//~^ ERROR arithmetic operation will overflow
37+
2538
const DIV: i32 = (1/0) + T::DIV;
2639
//~^ ERROR operation will panic
40+
const VID: i32 = T::DIV + (1/0);
41+
//~^ ERROR operation will panic
42+
2743
const OOB: i32 = [1][1] + T::OOB;
2844
//~^ ERROR operation will panic
45+
const BOO: i32 = T::OOB + [1][1];
46+
//~^ ERROR operation will panic
2947
}

0 commit comments

Comments
 (0)