From 387b157406a0962f3b921cd501367cb9c365cc5e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emilio=20Cobos=20=C3=81lvarez?= Date: Tue, 21 Jul 2026 16:51:40 +0200 Subject: [PATCH] macros: Allow syn 3.0. This loses the guard assert in 2.0, but the rest works just fine. The assert is covered by the panic in syn 3.0. It's useful to keep 2.0 working since phf_macros does depend on syn 2.0 for now. Closes #431 --- macros/Cargo.toml | 2 +- macros/lib.rs | 5 ++--- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/macros/Cargo.toml b/macros/Cargo.toml index 13f00d30..f0e875da 100644 --- a/macros/Cargo.toml +++ b/macros/Cargo.toml @@ -14,4 +14,4 @@ proc-macro = true [dependencies] quote = "1.0.29" -syn = {version = "2", features = ["full", "extra-traits"]} +syn = { version = ">=2,<4", features = ["full", "extra-traits"] } diff --git a/macros/lib.rs b/macros/lib.rs index bcb96504..e900d150 100644 --- a/macros/lib.rs +++ b/macros/lib.rs @@ -71,7 +71,7 @@ fn parse_pat_to_table<'a>( } } _ => { - panic!("Unexpected pattern: {:?}. Buggy code ?", pat); + panic!("Unexpected or unsupported pattern: {:?}. Buggy code ?", pat); } } } @@ -80,7 +80,7 @@ fn parse_pat_to_table<'a>( /// /// ## Example /// -/// ```rust +/// ```rust,ignore /// match_byte! { tokenizer.next_byte_unchecked(), /// b'a'..b'z' => { ... } /// b'0'..b'9' => { ... } @@ -109,7 +109,6 @@ pub fn match_byte(input: TokenStream) -> TokenStream { let mut arms = Vec::new(); while !input.is_empty() { let arm = input.call(syn::Arm::parse)?; - assert!(arm.guard.is_none(), "match_byte doesn't support guards"); assert!( arm.attrs.is_empty(), "match_byte doesn't support attributes"