Skip to content

Commit

Permalink
Merge pull request #1627 from dtolnay/patident
Browse files Browse the repository at this point in the history
Check for legal binding name in the ident of Pat::Ident
  • Loading branch information
dtolnay committed Apr 18, 2024
2 parents 6a28926 + 348a0e7 commit 1b20403
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/pat.rs
Expand Up @@ -470,7 +470,13 @@ pub(crate) mod parsing {
attrs: Vec::new(),
by_ref: input.parse()?,
mutability: input.parse()?,
ident: input.call(Ident::parse_any)?,
ident: {
if input.peek(Token![self]) {
input.call(Ident::parse_any)?
} else {
input.parse()?
}
},
subpat: {
if input.peek(Token![@]) {
let at_token: Token![@] = input.parse()?;
Expand Down

0 comments on commit 1b20403

Please sign in to comment.