Skip to content

Commit 903b439

Browse files
authored
Rollup merge of #110022 - Ezrashaw:fix-parser-ident-regression, r=compiler-errors
fix: fix regression in #109203 Fixes #110014 r? `@compiler-errors`
2 parents 273b221 + 9dbf20e commit 903b439

File tree

3 files changed

+24
-2
lines changed

3 files changed

+24
-2
lines changed

compiler/rustc_parse/src/parser/diagnostics.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -423,11 +423,11 @@ impl<'a> Parser<'a> {
423423
if let token::Literal(Lit {
424424
kind: token::LitKind::Integer | token::LitKind::Float,
425425
symbol,
426-
suffix,
426+
suffix: Some(suffix), // no suffix makes it a valid literal
427427
}) = self.token.kind
428428
&& rustc_ast::MetaItemLit::from_token(&self.token).is_none()
429429
{
430-
Some((symbol.as_str().len(), suffix.unwrap()))
430+
Some((symbol.as_str().len(), suffix))
431431
} else {
432432
None
433433
}
+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
fn`2222222222222222222222222222222222222222() {}
2+
//~^ ERROR unknown start of token: `
3+
//~^^ ERROR expected identifier, found `2222222222222222222222222222222222222222`
+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
error: unknown start of token: `
2+
--> $DIR/issue-110014.rs:1:3
3+
|
4+
LL | fn`2222222222222222222222222222222222222222() {}
5+
| ^
6+
|
7+
help: Unicode character '`' (Grave Accent) looks like ''' (Single Quote), but it is not
8+
|
9+
LL | fn'2222222222222222222222222222222222222222() {}
10+
| ~
11+
12+
error: expected identifier, found `2222222222222222222222222222222222222222`
13+
--> $DIR/issue-110014.rs:1:4
14+
|
15+
LL | fn`2222222222222222222222222222222222222222() {}
16+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected identifier
17+
18+
error: aborting due to 2 previous errors
19+

0 commit comments

Comments
 (0)