-
Notifications
You must be signed in to change notification settings - Fork 13.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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
- Loading branch information
1 parent
01f2a15
commit 3046af0
Showing
2 changed files
with
45 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
// The purpose of this test is not to validate the output of the compiler. | ||
// Instead, it ensures the suggestion is generated without performing an arithmetic overflow. | ||
|
||
fn main() { | ||
let x = not_found; //~ ERROR cannot find value `not_found` in this scope | ||
simd_gt::<()>(x); | ||
//~^ ERROR this associated function takes 0 generic arguments but 1 generic argument was supplied | ||
//~| ERROR cannot find function `simd_gt` in this scope | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
error[E0425]: cannot find value `not_found` in this scope | ||
--> $DIR/issue-104287.rs:5:13 | ||
| | ||
LL | let x = not_found; | ||
| ^^^^^^^^^ not found in this scope | ||
|
||
error[E0107]: this associated function takes 0 generic arguments but 1 generic argument was supplied | ||
--> $DIR/issue-104287.rs:6:5 | ||
| | ||
LL | simd_gt::<()>(x); | ||
| ^^^^^^^------ help: remove these generics | ||
| | | ||
| expected 0 generic arguments | ||
| | ||
note: associated function defined here, with 0 generic parameters | ||
--> $SRC_DIR/core/src/../../portable-simd/crates/core_simd/src/ord.rs:LL:COL | ||
| | ||
LL | fn simd_gt(self, other: Self) -> Self::Mask; | ||
| ^^^^^^^ | ||
|
||
error[E0425]: cannot find function `simd_gt` in this scope | ||
--> $DIR/issue-104287.rs:6:5 | ||
| | ||
LL | simd_gt::<()>(x); | ||
| ^^^^^^^ not found in this scope | ||
| | ||
help: use the `.` operator to call the method `SimdPartialOrd::simd_gt` on `[type error]` | ||
| | ||
LL - simd_gt::<()>(x); | ||
LL + x.simd_gt(); | ||
| | ||
|
||
error: aborting due to 3 previous errors | ||
|
||
Some errors have detailed explanations: E0107, E0425. | ||
For more information about an error, try `rustc --explain E0107`. |