Skip to content

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

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

Closed
matthiaskrgr opened this issue Dec 19, 2022 · 1 comment · Fixed by #106361
Closed

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

matthiaskrgr opened this issue Dec 19, 2022 · 1 comment · Fixed by #106361
Assignees
Labels
A-diagnostics Area: Messages for errors, warnings, and lints T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@matthiaskrgr
Copy link
Member

matthiaskrgr commented Dec 19, 2022

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

@matthiaskrgr matthiaskrgr added A-diagnostics Area: Messages for errors, warnings, and lints T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Dec 19, 2022
@matthiaskrgr matthiaskrgr 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 Dec 19, 2022
@lyming2007
Copy link

@rustbot claim

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-diagnostics Area: Messages for errors, warnings, and lints T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants