Skip to content

Commit 99b43a0

Browse files
authored
macros: Allow syn 3.0. (#432)
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
1 parent 4c49486 commit 99b43a0

2 files changed

Lines changed: 3 additions & 4 deletions

File tree

‎macros/Cargo.toml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,4 @@ proc-macro = true
1414

1515
[dependencies]
1616
quote = "1.0.29"
17-
syn = {version = "2", features = ["full", "extra-traits"]}
17+
syn = { version = ">=2,<4", features = ["full", "extra-traits"] }

‎macros/lib.rs‎

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ fn parse_pat_to_table<'a>(
7171
}
7272
}
7373
_ => {
74-
panic!("Unexpected pattern: {:?}. Buggy code ?", pat);
74+
panic!("Unexpected or unsupported pattern: {:?}. Buggy code ?", pat);
7575
}
7676
}
7777
}
@@ -80,7 +80,7 @@ fn parse_pat_to_table<'a>(
8080
///
8181
/// ## Example
8282
///
83-
/// ```rust
83+
/// ```rust,ignore
8484
/// match_byte! { tokenizer.next_byte_unchecked(),
8585
/// b'a'..b'z' => { ... }
8686
/// b'0'..b'9' => { ... }
@@ -109,7 +109,6 @@ pub fn match_byte(input: TokenStream) -> TokenStream {
109109
let mut arms = Vec::new();
110110
while !input.is_empty() {
111111
let arm = input.call(syn::Arm::parse)?;
112-
assert!(arm.guard.is_none(), "match_byte doesn't support guards");
113112
assert!(
114113
arm.attrs.is_empty(),
115114
"match_byte doesn't support attributes"

0 commit comments

Comments
 (0)