Closed
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
Area: Constant evaluation, covers all const contexts (static, const fn, ...)Area: Messages for errors, warnings, and lintsCategory: This is a bug.High priorityRelevant to the compiler team, which will review and decide on the PR/issue.Performance or correctness regression from stable to beta.Marks issues that should be documented in the release notes of the next release.