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 c098322
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 10 deletions.
3 changes: 1 addition & 2 deletions src/pat.rs
Expand Up @@ -242,7 +242,6 @@ pub(crate) mod parsing {
use crate::expr::{
Expr, ExprConst, ExprLit, ExprMacro, ExprPath, ExprRange, Member, RangeLimits,
};
use crate::ext::IdentExt as _;
use crate::ident::Ident;
use crate::lit::Lit;
use crate::mac::{self, Macro};
Expand Down Expand Up @@ -470,7 +469,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 c098322

Please sign in to comment.