-
Notifications
You must be signed in to change notification settings - Fork 13.5k
Closed
Labels
A-const-evalArea: Constant evaluation, covers all const contexts (static, const fn, ...)Area: Constant evaluation, covers all const contexts (static, const fn, ...)A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsC-bugCategory: This is a bug.Category: This is a bug.P-highHigh priorityHigh priorityT-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.regression-from-stable-to-betaPerformance or correctness regression from stable to beta.Performance or correctness regression from stable to beta.relnotesMarks issues that should be documented in the release notes of the next release.Marks issues that should be documented in the release notes of the next release.
Description
use std::{u64, usize};
fn main() {
if (usize::MAX as u64) < u64::MAX {
println!("{}", 1 + usize::MAX as u64);
} else {
println!("disqualified!");
}
}
This compiles and runs fine on a 32-bit target, but fails on 64-bit 1.29.0-beta.1:
error: attempt to add with overflow
--> src/main.rs:5:24
|
5 | println!("{}", 1 + usize::MAX as u64);
| ^^^^^^^^^^^^^^^^^^^^^
|
= note: #[deny(const_err)] on by default
The same code is fine without even a warning on 64-bit stable 1.27.2. It's also fine on the pre-release 1.28.0 where const-err
became deny
-by-default (#50653), because the lint isn't triggering at all.
I'm guessing that const-eval is just evaluating more now, thus triggering the lint more often. If this is decided not to be called a regression, it at least warrants a release note for 1.29.
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, ...)A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsC-bugCategory: This is a bug.Category: This is a bug.P-highHigh priorityHigh priorityT-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.regression-from-stable-to-betaPerformance or correctness regression from stable to beta.Performance or correctness regression from stable to beta.relnotesMarks issues that should be documented in the release notes of the next release.Marks issues that should be documented in the release notes of the next release.