Skip to content

regression: literal out of range #137893

Closed
Closed

Description

@Mark-Simulacrum

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

Activity

  1. added
    T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.
    on Mar 2, 2025
  2. added this to the 1.86.0 milestone on Mar 2, 2025
  3. added
    I-prioritizeIssue needs a team member to assess the impact. Will be replaced by P-{low,medium,high,critical}
    needs-triageThis issue may need triage. Remove when done. See docs forge.rust-lang.org/release/issue-triaging
    on Mar 2, 2025
  4. self-assigned this
    on Mar 2, 2025
  5. ehuss commented on Mar 2, 2025

    @ehuss
    Contributor

    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.

  6. oli-obk commented on Mar 2, 2025

    @oli-obk
    Contributor

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

  7. oli-obk commented on Mar 2, 2025

    @oli-obk
    Contributor

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

  8. apiraino commented on Mar 3, 2025

    @apiraino
    Contributor

    WG-prioritization assigning priority (Zulip discussion).

    @rustbot label -I-prioritize +P-high

  9. added
    P-highHigh priority
    and removed
    I-prioritizeIssue needs a team member to assess the impact. Will be replaced by P-{low,medium,high,critical}
    on Mar 3, 2025
  10. removed
    needs-triageThis issue may need triage. Remove when done. See docs forge.rust-lang.org/release/issue-triaging
    on Mar 13, 2025
  11. wesleywiser commented on Mar 13, 2025

    @wesleywiser
    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?

  12. apiraino commented on Mar 27, 2025

    @apiraino
    Contributor

    closing as accepted change

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

P-highHigh priorityT-compilerRelevant 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.

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions