Skip to content

Commit 3046af0

Browse files
committed
Add a UI test to ensure rustc doesn't do arithmetic overflows
This relies on the CI testing a rustc that's compiled with overflow-checks = true
1 parent 01f2a15 commit 3046af0

File tree

2 files changed

+45
-0
lines changed

2 files changed

+45
-0
lines changed
+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
// The purpose of this test is not to validate the output of the compiler.
2+
// Instead, it ensures the suggestion is generated without performing an arithmetic overflow.
3+
4+
fn main() {
5+
let x = not_found; //~ ERROR cannot find value `not_found` in this scope
6+
simd_gt::<()>(x);
7+
//~^ ERROR this associated function takes 0 generic arguments but 1 generic argument was supplied
8+
//~| ERROR cannot find function `simd_gt` in this scope
9+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
error[E0425]: cannot find value `not_found` in this scope
2+
--> $DIR/issue-104287.rs:5:13
3+
|
4+
LL | let x = not_found;
5+
| ^^^^^^^^^ not found in this scope
6+
7+
error[E0107]: this associated function takes 0 generic arguments but 1 generic argument was supplied
8+
--> $DIR/issue-104287.rs:6:5
9+
|
10+
LL | simd_gt::<()>(x);
11+
| ^^^^^^^------ help: remove these generics
12+
| |
13+
| expected 0 generic arguments
14+
|
15+
note: associated function defined here, with 0 generic parameters
16+
--> $SRC_DIR/core/src/../../portable-simd/crates/core_simd/src/ord.rs:LL:COL
17+
|
18+
LL | fn simd_gt(self, other: Self) -> Self::Mask;
19+
| ^^^^^^^
20+
21+
error[E0425]: cannot find function `simd_gt` in this scope
22+
--> $DIR/issue-104287.rs:6:5
23+
|
24+
LL | simd_gt::<()>(x);
25+
| ^^^^^^^ not found in this scope
26+
|
27+
help: use the `.` operator to call the method `SimdPartialOrd::simd_gt` on `[type error]`
28+
|
29+
LL - simd_gt::<()>(x);
30+
LL + x.simd_gt();
31+
|
32+
33+
error: aborting due to 3 previous errors
34+
35+
Some errors have detailed explanations: E0107, E0425.
36+
For more information about an error, try `rustc --explain E0107`.

0 commit comments

Comments
 (0)