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:
commit
11020b93b6
10 changed files with 88 additions and 32 deletions
|
@ -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) }
|
||||
})
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue