Skip to content

Commit

Permalink
fix: fix regression in rust-lang#109203
Browse files Browse the repository at this point in the history
  • Loading branch information
Ezrashaw committed Apr 6, 2023
1 parent f5b8f44 commit 9dbf20e
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 2 deletions.
4 changes: 2 additions & 2 deletions compiler/rustc_parse/src/parser/diagnostics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -423,11 +423,11 @@ impl<'a> Parser<'a> {
if let token::Literal(Lit {
kind: token::LitKind::Integer | token::LitKind::Float,
symbol,
suffix,
suffix: Some(suffix), // no suffix makes it a valid literal
}) = self.token.kind
&& rustc_ast::MetaItemLit::from_token(&self.token).is_none()
{
Some((symbol.as_str().len(), suffix.unwrap()))
Some((symbol.as_str().len(), suffix))
} else {
None
}
Expand Down
3 changes: 3 additions & 0 deletions tests/ui/parser/issues/issue-110014.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
fn`2222222222222222222222222222222222222222() {}
//~^ ERROR unknown start of token: `
//~^^ ERROR expected identifier, found `2222222222222222222222222222222222222222`
19 changes: 19 additions & 0 deletions tests/ui/parser/issues/issue-110014.stderr
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 9dbf20e

Please sign in to comment.