Rollup merge of #110022 - Ezrashaw:fix-parser-ident-regression, r=compiler-errors
fix: fix regression in #109203 Fixes #110014 r? `@compiler-errors`
This commit is contained in:
commit
903b439cac
@ -423,11 +423,11 @@ impl<'a> Parser<'a> {
|
|||||||
if let token::Literal(Lit {
|
if let token::Literal(Lit {
|
||||||
kind: token::LitKind::Integer | token::LitKind::Float,
|
kind: token::LitKind::Integer | token::LitKind::Float,
|
||||||
symbol,
|
symbol,
|
||||||
suffix,
|
suffix: Some(suffix), // no suffix makes it a valid literal
|
||||||
}) = self.token.kind
|
}) = self.token.kind
|
||||||
&& rustc_ast::MetaItemLit::from_token(&self.token).is_none()
|
&& rustc_ast::MetaItemLit::from_token(&self.token).is_none()
|
||||||
{
|
{
|
||||||
Some((symbol.as_str().len(), suffix.unwrap()))
|
Some((symbol.as_str().len(), suffix))
|
||||||
} else {
|
} else {
|
||||||
None
|
None
|
||||||
}
|
}
|
||||||
|
3
tests/ui/parser/issues/issue-110014.rs
Normal file
3
tests/ui/parser/issues/issue-110014.rs
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
fn`2222222222222222222222222222222222222222() {}
|
||||||
|
//~^ ERROR unknown start of token: `
|
||||||
|
//~^^ ERROR expected identifier, found `2222222222222222222222222222222222222222`
|
19
tests/ui/parser/issues/issue-110014.stderr
Normal file
19
tests/ui/parser/issues/issue-110014.stderr
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
error: unknown start of token: `
|
||||||
|
--> $DIR/issue-110014.rs:1:3
|
||||||
|
|
|
||||||
|
LL | fn`2222222222222222222222222222222222222222() {}
|
||||||
|
| ^
|
||||||
|
|
|
||||||
|
help: Unicode character '`' (Grave Accent) looks like ''' (Single Quote), but it is not
|
||||||
|
|
|
||||||
|
LL | fn'2222222222222222222222222222222222222222() {}
|
||||||
|
| ~
|
||||||
|
|
||||||
|
error: expected identifier, found `2222222222222222222222222222222222222222`
|
||||||
|
--> $DIR/issue-110014.rs:1:4
|
||||||
|
|
|
||||||
|
LL | fn`2222222222222222222222222222222222222222() {}
|
||||||
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected identifier
|
||||||
|
|
||||||
|
error: aborting due to 2 previous errors
|
||||||
|
|
Loading…
x
Reference in New Issue
Block a user