From 0a0303607e8cb8d3301583b942121a3450bd13a1 Mon Sep 17 00:00:00 2001 From: David Tolnay Date: Wed, 17 Apr 2024 22:47:37 -0700 Subject: [PATCH] Require ident in PatIdent to be a legal binding name --- src/pat.rs | 2 +- tests/test_pat.rs | 8 -------- 2 files changed, 1 insertion(+), 9 deletions(-) diff --git a/src/pat.rs b/src/pat.rs index c029bae83..8c736693e 100644 --- a/src/pat.rs +++ b/src/pat.rs @@ -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()?; diff --git a/tests/test_pat.rs b/tests/test_pat.rs index 3d13385fd..2231656f7 100644 --- a/tests/test_pat.rs +++ b/tests/test_pat.rs @@ -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() {