Skip to content

Commit 7f4c82e

Browse files
committed
macros: Update to syn 3.0
1 parent dbe19c2 commit 7f4c82e

3 files changed

Lines changed: 8 additions & 9 deletions

File tree

Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ regex = "1.12.3"
6868
rug = { version = "1.28.1", default-features = false, features = ["float", "integer", "std"] }
6969
rustc_apfloat = "0.2.3"
7070
serde_json = "1.0.149"
71-
syn = "2.0.115"
71+
syn = "3.0.3"
7272
tempfile = "3.25.0"
7373

7474
[profile.release]

crates/libm-macros/src/parse.rs

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,6 @@ fn extract_fn_extra_field(expr: Expr) -> syn::Result<BTreeMap<Ident, Expr>> {
181181
let Arm {
182182
attrs,
183183
pat,
184-
guard,
185184
fat_arrow_token: _,
186185
body,
187186
comma: _,
@@ -190,15 +189,15 @@ fn extract_fn_extra_field(expr: Expr) -> syn::Result<BTreeMap<Ident, Expr>> {
190189
expect_empty_attrs(&attrs)?;
191190

192191
let keys = match pat {
192+
syn::Pat::Ident(id) => Parser::parse2(parse_ident_pat, id.into_token_stream())?,
193+
syn::Pat::Or(or) => Parser::parse2(parse_ident_pat, or.into_token_stream())?,
193194
syn::Pat::Wild(w) => vec![Ident::new("_", w.span())],
194-
_ => Parser::parse2(parse_ident_pat, pat.into_token_stream())?,
195+
_ => {
196+
let e = syn::Error::new(pat.span(), "unsupported pattern type");
197+
return Err(e);
198+
}
195199
};
196200

197-
if let Some(guard) = guard {
198-
let e = syn::Error::new(guard.0.span(), "no guards allowed in this position");
199-
return Err(e);
200-
}
201-
202201
for key in keys {
203202
let inserted = res.insert(key.clone(), *body.clone());
204203
if inserted.is_some() {

0 commit comments

Comments
 (0)