Skip to content

"error: integer literal is too large" should mention the actual type limit #105908

Closed
@matthiaskrgr

Description

@matthiaskrgr
Member

Given the following code:

pub fn main() {
    let x = [0; 1111111111111111111111111111111111111111111111111111111_u128];
}

The current output is:

error: integer literal is too large
 --> src/main.rs:2:17
  |
2 |     let x = [0; 1111111111111111111111111111111111111111111111111111111_u128];
  |                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

error: could not compile `playground` due to previous error

It would be nice if the message could say something like "integer literal is too large, value exceeds limit of ${u128::MAX}" or something like that

Activity

added
A-diagnosticsArea: Messages for errors, warnings, and lints
T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.
on Dec 19, 2022
changed the title [-]"error: integer literal is too large" should tell about limit[/-] [+]"error: integer literal is too large" should mention the actual type limit[/+] on Dec 19, 2022
lyming2007

lyming2007 commented on Dec 19, 2022

@lyming2007

@rustbot claim

added a commit that references this issue on Jan 4, 2023

Rollup merge of rust-lang#106361 - clubby789:int-literal-too-large, r…

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

Metadata

Metadata

Assignees

Labels

A-diagnosticsArea: Messages for errors, warnings, and lintsT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

    Development

    Participants

    @lyming2007@matthiaskrgr

    Issue actions

      "error: integer literal is too large" should mention the actual type limit · Issue #105908 · rust-lang/rust