Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

regression: literal out of range #137893

Open
Mark-Simulacrum opened this issue Mar 2, 2025 · 5 comments
Open

regression: literal out of range #137893

Mark-Simulacrum opened this issue Mar 2, 2025 · 5 comments
Assignees
Labels
P-high High priority regression-from-stable-to-beta Performance or correctness regression from stable to beta. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Milestone

Comments

@Mark-Simulacrum
Copy link
Member

https://crater-reports.s3.amazonaws.com/beta-1.86-3/beta-2025-02-28/reg/checked_expr-0.3.0/log.txt

cc @oli-obk since I think you were refactoring something here recently?

[INFO] [stdout] error: literal out of range for `i8`
[INFO] [stdout]   --> src/lib.rs:25:29
[INFO] [stdout]    |
[INFO] [stdout] 10 | assert_eq!(checked_expr!(-(-128_i8)), None);
[INFO] [stdout]    |                             ^^^^^^
[INFO] [stdout]    |
[INFO] [stdout]    = note: the literal `128_i8` does not fit into the type `i8` whose range is `-128..=127`
[INFO] [stdout]    = help: consider using the type `u8` instead
[INFO] [stdout]    = note: `#[deny(overflowing_literals)]` on by default
@Mark-Simulacrum Mark-Simulacrum added regression-from-stable-to-beta Performance or correctness regression from stable to beta. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Mar 2, 2025
@Mark-Simulacrum Mark-Simulacrum added this to the 1.86.0 milestone Mar 2, 2025
@rustbot rustbot added I-prioritize Issue: Indicates that prioritization has been requested for this issue. needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. labels Mar 2, 2025
@oli-obk oli-obk self-assigned this Mar 2, 2025
@ehuss
Copy link
Contributor

ehuss commented Mar 2, 2025

This bisects to #136393

What's interesting is that the expanded code:

(|| Some((128_i8).checked_neg()?.checked_neg()?))();

fires the lint on stable, but the proc-macro does not.

@oli-obk
Copy link
Contributor

oli-obk commented Mar 2, 2025

yea I was just reading the proc macro source and was wondering how this ever worked. Turns out 128_i8 overflows into -128_i8 💀

@oli-obk
Copy link
Contributor

oli-obk commented Mar 2, 2025

So I guess I made another accidental bugfix with these refactorings, yay

@apiraino
Copy link
Contributor

apiraino commented Mar 3, 2025

WG-prioritization assigning priority (Zulip discussion).

@rustbot label -I-prioritize +P-high

@rustbot rustbot added P-high High priority and removed I-prioritize Issue: Indicates that prioritization has been requested for this issue. labels Mar 3, 2025
@wesleywiser wesleywiser removed the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Mar 13, 2025
@wesleywiser
Copy link
Member

Discussed briefly in the compiler team triage meeting. It looks like this is an expected fix to lint behavior.

Should we mention this in release notes for 1.86?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
P-high High priority regression-from-stable-to-beta Performance or correctness regression from stable to beta. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

6 participants