From 98eddf9b292cb42e28b789621434092606feb664 Mon Sep 17 00:00:00 2001 From: David Tolnay Date: Sat, 1 Sep 2018 23:03:06 -0700 Subject: [PATCH] Update to syn 0.15-rc1 --- serde_derive/Cargo.toml | 2 +- serde_derive/src/internals/attr.rs | 20 ++++++++++---------- serde_derive_internals/Cargo.toml | 2 +- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/serde_derive/Cargo.toml b/serde_derive/Cargo.toml index 7fa379e2..7a51a950 100644 --- a/serde_derive/Cargo.toml +++ b/serde_derive/Cargo.toml @@ -26,7 +26,7 @@ proc-macro = true [dependencies] proc-macro2 = "0.4" quote = "0.6.3" -syn = { version = "0.14", features = ["visit"] } +syn-next = { version = "0.15.0-rc1", features = ["visit"] } [dev-dependencies] serde = { version = "1.0", path = "../serde" } diff --git a/serde_derive/src/internals/attr.rs b/serde_derive/src/internals/attr.rs index 3f399ded..711339b1 100644 --- a/serde_derive/src/internals/attr.rs +++ b/serde_derive/src/internals/attr.rs @@ -11,8 +11,8 @@ use proc_macro2::{Group, Span, TokenStream, TokenTree}; use std::collections::BTreeSet; use std::str::FromStr; use syn; +use syn::parse::{self, Parse, ParseStream}; use syn::punctuated::Punctuated; -use syn::synom::{ParseError, Synom}; use syn::Ident; use syn::Meta::{List, NameValue, Word}; use syn::NestedMeta::{Literal, Meta}; @@ -1300,11 +1300,10 @@ fn parse_lit_into_lifetimes( struct BorrowedLifetimes(Punctuated); - impl Synom for BorrowedLifetimes { - named!(parse -> Self, map!( - call!(Punctuated::parse_separated_nonempty), - BorrowedLifetimes - )); + impl Parse for BorrowedLifetimes { + fn parse(input: ParseStream) -> parse::Result { + Punctuated::parse_separated_nonempty(input).map(BorrowedLifetimes) + } } if let Ok(BorrowedLifetimes(lifetimes)) = parse_lit_str(string) { @@ -1513,7 +1512,8 @@ fn collect_lifetimes(ty: &syn::Type, out: &mut BTreeSet) { syn::GenericArgument::Binding(ref binding) => { collect_lifetimes(&binding.ty, out); } - syn::GenericArgument::Const(_) => {} + syn::GenericArgument::Constraint(_) + | syn::GenericArgument::Const(_) => {} } } } @@ -1535,15 +1535,15 @@ fn collect_lifetimes(ty: &syn::Type, out: &mut BTreeSet) { } } -fn parse_lit_str(s: &syn::LitStr) -> Result +fn parse_lit_str(s: &syn::LitStr) -> parse::Result where - T: Synom, + T: Parse, { let tokens = try!(spanned_tokens(s)); syn::parse2(tokens) } -fn spanned_tokens(s: &syn::LitStr) -> Result { +fn spanned_tokens(s: &syn::LitStr) -> parse::Result { let stream = try!(syn::parse_str(&s.value())); Ok(respan_token_stream(stream, s.span())) } diff --git a/serde_derive_internals/Cargo.toml b/serde_derive_internals/Cargo.toml index 12cc7c8d..3ce4add1 100644 --- a/serde_derive_internals/Cargo.toml +++ b/serde_derive_internals/Cargo.toml @@ -16,7 +16,7 @@ path = "lib.rs" [dependencies] proc-macro2 = "0.4" -syn = { version = "0.14", default-features = false, features = ["derive", "parsing", "clone-impls"] } +syn-next = { version = "0.15.0-rc1", default-features = false, features = ["derive", "parsing", "clone-impls"] } [badges] travis-ci = { repository = "serde-rs/serde" }