Skip to content

Commit

Permalink
Require ident in PatIdent to be a legal binding name
Browse files Browse the repository at this point in the history
  • Loading branch information
dtolnay committed Apr 18, 2024
1 parent 6a28926 commit 0a03036
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 9 deletions.
2 changes: 1 addition & 1 deletion src/pat.rs
Expand Up @@ -470,7 +470,7 @@ pub(crate) mod parsing {
attrs: Vec::new(),
by_ref: input.parse()?,
mutability: input.parse()?,
ident: input.call(Ident::parse_any)?,
ident: input.parse()?,
subpat: {
if input.peek(Token![@]) {
let at_token: Token![@] = input.parse()?;
Expand Down
8 changes: 0 additions & 8 deletions tests/test_pat.rs
Expand Up @@ -9,14 +9,6 @@ use syn::parse::Parser;
use syn::punctuated::Punctuated;
use syn::{parse_quote, token, Item, Pat, PatTuple, Stmt, Token};

#[test]
fn test_pat_ident() {
match Pat::parse_single.parse2(quote!(self)).unwrap() {
Pat::Ident(_) => (),
value => panic!("expected PatIdent, got {:?}", value),
}
}

#[test]
fn test_pat_path() {
match Pat::parse_single.parse2(quote!(self::CONST)).unwrap() {
Expand Down

0 comments on commit 0a03036

Please sign in to comment.