Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commita01f49e

Browse files
committed
check is_ident before parse_ident
1 parent8c39ac9 commita01f49e

File tree

3 files changed

+12
-2
lines changed

3 files changed

+12
-2
lines changed

‎compiler/rustc_parse/src/parser/item.rs‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -387,8 +387,8 @@ impl<'a> Parser<'a> {
387387
let span =if is_pub{self.prev_token.span.to(ident_span)}else{ ident_span};
388388
let insert_span = ident_span.shrink_to_lo();
389389

390-
let ident =if(!is_const
391-
||self.look_ahead(1, |t|*t == token::OpenDelim(Delimiter::Parenthesis)))
390+
let ident =ifself.token.is_ident()
391+
&&(!is_const||self.look_ahead(1, |t|*t == token::OpenDelim(Delimiter::Parenthesis)))
392392
&&self.look_ahead(1, |t|{
393393
[
394394
token::Lt,
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
const!(&rawmut a);
2+
//~^ ERROR expected identifier, found `!`
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
error: expected identifier, found `!`
2+
--> $DIR/ice-issue-127600.rs:1:6
3+
|
4+
LL | const!(&raw mut a);
5+
| ^ expected identifier
6+
7+
error: aborting due to 1 previous error
8+

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp