1
Fork 0

Rollup merge of #106361 - clubby789:int-literal-too-large, r=estebank

Note maximum integer literal for `IntLiteralTooLarge`

Closes #105908

`@rustbot` label +A-diagnostics
This commit is contained in:
Matthias Krüger 2023-01-04 07:28:56 +01:00 committed by GitHub
commit 11020b93b6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
10 changed files with 88 additions and 32 deletions

View file

@ -34,7 +34,7 @@ pub enum LitError {
InvalidIntSuffix,
InvalidFloatSuffix,
NonDecimalFloat(u32),
IntTooLarge,
IntTooLarge(u32),
}
impl LitKind {
@ -333,6 +333,6 @@ fn integer_lit(symbol: Symbol, suffix: Option<Symbol>) -> Result<LitKind, LitErr
// but these kinds of errors are already reported by the lexer.
let from_lexer =
base < 10 && s.chars().any(|c| c.to_digit(10).map_or(false, |d| d >= base));
if from_lexer { LitError::LexerError } else { LitError::IntTooLarge }
if from_lexer { LitError::LexerError } else { LitError::IntTooLarge(base) }
})
}