mirror of
https://github.com/rust-lang/rust.git
synced 2025-02-13 23:42:56 +00:00
Rollup merge of #127601 - trevyn:issue-127600, r=compiler-errors
check is_ident before parse_ident Closes #127600
This commit is contained in:
commit
d433f176ef
@ -387,8 +387,8 @@ impl<'a> Parser<'a> {
|
|||||||
let span = if is_pub { self.prev_token.span.to(ident_span) } else { ident_span };
|
let span = if is_pub { self.prev_token.span.to(ident_span) } else { ident_span };
|
||||||
let insert_span = ident_span.shrink_to_lo();
|
let insert_span = ident_span.shrink_to_lo();
|
||||||
|
|
||||||
let ident = if (!is_const
|
let ident = if self.token.is_ident()
|
||||||
|| self.look_ahead(1, |t| *t == token::OpenDelim(Delimiter::Parenthesis)))
|
&& (!is_const || self.look_ahead(1, |t| *t == token::OpenDelim(Delimiter::Parenthesis)))
|
||||||
&& self.look_ahead(1, |t| {
|
&& self.look_ahead(1, |t| {
|
||||||
[
|
[
|
||||||
token::Lt,
|
token::Lt,
|
||||||
|
2
tests/ui/parser/ice-issue-127600.rs
Normal file
2
tests/ui/parser/ice-issue-127600.rs
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
const!(&raw mut a);
|
||||||
|
//~^ ERROR expected identifier, found `!`
|
8
tests/ui/parser/ice-issue-127600.stderr
Normal file
8
tests/ui/parser/ice-issue-127600.stderr
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
error: expected identifier, found `!`
|
||||||
|
--> $DIR/ice-issue-127600.rs:1:6
|
||||||
|
|
|
||||||
|
LL | const!(&raw mut a);
|
||||||
|
| ^ expected identifier
|
||||||
|
|
||||||
|
error: aborting due to 1 previous error
|
||||||
|
|
Loading…
Reference in New Issue
Block a user