extract error_float_lits-must_have_int_part
This commit is contained in:
parent
aa8adba8fb
commit
0bb3dad5a6
@ -1141,14 +1141,7 @@ impl<'a> Parser<'a> {
|
||||
});
|
||||
if let Some(token) = &recovered {
|
||||
self.bump();
|
||||
self.struct_span_err(token.span, "float literals must have an integer part")
|
||||
.span_suggestion(
|
||||
token.span,
|
||||
"must have an integer part",
|
||||
pprust::token_to_string(token),
|
||||
Applicability::MachineApplicable,
|
||||
)
|
||||
.emit();
|
||||
self.error_float_lits_must_have_int_part(&token);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1177,6 +1170,17 @@ impl<'a> Parser<'a> {
|
||||
}
|
||||
}
|
||||
|
||||
fn error_float_lits_must_have_int_part(&self, token: &Token) {
|
||||
self.struct_span_err(token.span, "float literals must have an integer part")
|
||||
.span_suggestion(
|
||||
token.span,
|
||||
"must have an integer part",
|
||||
pprust::token_to_string(token),
|
||||
Applicability::MachineApplicable,
|
||||
)
|
||||
.emit();
|
||||
}
|
||||
|
||||
fn report_lit_error(&self, err: LitError, lit: token::Lit, span: Span) {
|
||||
// Checks if `s` looks like i32 or u1234 etc.
|
||||
fn looks_like_width_suffix(first_chars: &[char], s: &str) -> bool {
|
||||
|
Loading…
x
Reference in New Issue
Block a user