-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Closed
Labels
A-const-evalArea: Constant evaluation, covers all const contexts (static, const fn, ...)Area: Constant evaluation, covers all const contexts (static, const fn, ...)C-bugCategory: This is a bug.Category: This is a bug.D-verboseDiagnostics: Too much output caused by a single piece of incorrect code.Diagnostics: Too much output caused by a single piece of incorrect code.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.
Description
When there is an overflowing division or remainder operation that const_prop can detect, the error is duplicated in release mode only:
#![deny(const_err)]
use std::i32;
fn main() {
let _ = i32::MIN / -1;
}
shows
error: attempt to divide with overflow
--> src/main.rs:6:13
|
6 | let _ = i32::MIN / -1;
| ^^^^^^^^^^^^^
|
note: the lint level is defined here
--> src/main.rs:1:9
|
1 | #![deny(const_err)]
| ^^^^^^^^^
error: this expression will panic at runtime
--> src/main.rs:6:13
|
6 | let _ = i32::MIN / -1;
| ^^^^^^^^^^^^^ attempt to divide with overflow
This is because !overflow_check
is true
in release mode but divison and remainder still get overflow checks.
(This test case already covers the problem, so a fix does not need a new test case, it just needs to adjust the existing test case to no longer expect two ERROR
per line.)
Metadata
Metadata
Assignees
Labels
A-const-evalArea: Constant evaluation, covers all const contexts (static, const fn, ...)Area: Constant evaluation, covers all const contexts (static, const fn, ...)C-bugCategory: This is a bug.Category: This is a bug.D-verboseDiagnostics: Too much output caused by a single piece of incorrect code.Diagnostics: Too much output caused by a single piece of incorrect code.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.