Skip to content

Commit 99039f6

Browse files
authored
Update to syn 0.15 (rust-lang#564)
1 parent 491b91d commit 99039f6

File tree

5 files changed

+28
-31
lines changed

5 files changed

+28
-31
lines changed

crates/assert-instr-macro/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,4 @@ test = false
1010
[dependencies]
1111
proc-macro2 = { version = "0.4", features = ["nightly"] }
1212
quote = "0.6"
13-
syn = { version = "0.14", features = ["full"] }
13+
syn = { version = "0.15", features = ["full"] }

crates/assert-instr-macro/src/lib.rs

Lines changed: 17 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ extern crate proc_macro;
1212
extern crate proc_macro2;
1313
#[macro_use]
1414
extern crate quote;
15-
#[macro_use]
1615
extern crate syn;
1716

1817
use proc_macro2::TokenStream;
@@ -150,25 +149,23 @@ struct Invoc {
150149
args: Vec<(syn::Ident, syn::Expr)>,
151150
}
152151

153-
impl syn::synom::Synom for Invoc {
154-
named!(parse -> Self, do_parse!(
155-
instr: alt!(
156-
map!(syn!(syn::Ident), |s| s.to_string())
157-
|
158-
map!(syn!(syn::LitStr), |s| s.value())
159-
) >>
160-
args: many0!(do_parse!(
161-
syn!(syn::token::Comma) >>
162-
name: syn!(syn::Ident) >>
163-
syn!(syn::token::Eq) >>
164-
expr: syn!(syn::Expr) >>
165-
(name, expr)
166-
)) >>
167-
(Invoc {
168-
instr,
169-
args,
170-
})
171-
));
152+
impl syn::parse::Parse for Invoc {
153+
fn parse(input: syn::parse::ParseStream) -> syn::parse::Result<Self> {
154+
use syn::Token;
155+
156+
let instr = match input.parse::<syn::Ident>() {
157+
Ok(s) => s.to_string(),
158+
Err(_) => input.parse::<syn::LitStr>()?.value(),
159+
};
160+
let mut args = Vec::new();
161+
while input.parse::<Token![,]>().is_ok() {
162+
let name = input.parse::<syn::Ident>()?;
163+
input.parse::<Token![=]>()?;
164+
let expr = input.parse::<syn::Expr>()?;
165+
args.push((name, expr));
166+
}
167+
Ok(Invoc { instr, args })
168+
}
172169
}
173170

174171
struct Append<T>(T);

crates/stdsimd-verify/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ authors = ["Alex Crichton <[email protected]>"]
66
[dependencies]
77
proc-macro2 = "0.4"
88
quote = "0.6"
9-
syn = { version = "0.14", features = ["full"] }
9+
syn = { version = "0.15", features = ["full"] }
1010

1111
[lib]
1212
proc-macro = true

crates/stdsimd-verify/src/lib.rs

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -242,15 +242,16 @@ struct RustcArgsRequiredConst {
242242
args: Vec<usize>,
243243
}
244244

245-
impl syn::synom::Synom for RustcArgsRequiredConst {
246-
named!(parse -> Self, do_parse!(
247-
items: parens!(
248-
call!(syn::punctuated::Punctuated::<syn::LitInt, syn::token::Comma>::parse_terminated)
249-
) >>
250-
(RustcArgsRequiredConst {
251-
args: items.1.into_iter()
245+
impl syn::parse::Parse for RustcArgsRequiredConst {
246+
fn parse(input: syn::parse::ParseStream) -> syn::parse::Result<Self> {
247+
let content;
248+
parenthesized!(content in input);
249+
let list = syn::punctuated::Punctuated::<syn::LitInt, Token![,]>
250+
::parse_terminated(&content)?;
251+
Ok(RustcArgsRequiredConst {
252+
args: list.into_iter()
252253
.map(|a| a.value() as usize)
253254
.collect(),
254255
})
255-
));
256+
}
256257
}

crates/stdsimd-verify/tests/x86-intel.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
#![feature(use_extern_macros)]
21
#![allow(bad_style)]
32
#![cfg_attr(
43
feature = "cargo-clippy",

0 commit comments

Comments
 (0)