Bump syntex to 0.43

This commit is contained in:
David Tolnay 2016-08-31 12:53:27 -07:00
parent 7014c105b4
commit 4bb9279074
No known key found for this signature in database
GPG Key ID: F9BA143B95FF6D82
7 changed files with 59 additions and 39 deletions

View File

@ -1,6 +1,6 @@
[package]
name = "serde"
version = "0.8.4"
version = "0.8.5"
authors = ["Erick Tryzelaar <erick.tryzelaar@gmail.com>"]
license = "MIT/Apache-2.0"
description = "A generic serialization/deserialization framework"

View File

@ -1,6 +1,6 @@
[package]
name = "serde_codegen"
version = "0.8.4"
version = "0.8.5"
authors = ["Erick Tryzelaar <erick.tryzelaar@gmail.com>"]
license = "MIT/Apache-2.0"
description = "Macros to auto-generate implementations for the serde framework"
@ -25,14 +25,14 @@ with-syntex = [
]
[build-dependencies]
quasi_codegen = { version = "^0.18.0", optional = true }
syntex = { version = "^0.42.2", optional = true }
quasi_codegen = { version = "^0.19.0", optional = true }
syntex = { version = "^0.43.0", optional = true }
[dependencies]
aster = { version = "^0.25.0", default-features = false }
aster = { version = "^0.26.0", default-features = false }
clippy = { version = "^0.*", optional = true }
quasi = { version = "^0.18.0", default-features = false }
quasi_macros = { version = "^0.18.0", optional = true }
serde_codegen_internals = { version = "=0.7.0", default-features = false, path = "../serde_codegen_internals" }
syntex = { version = "^0.42.2", optional = true }
syntex_syntax = { version = "^0.42.0", optional = true }
quasi = { version = "^0.19.0", default-features = false }
quasi_macros = { version = "^0.19.0", optional = true }
serde_codegen_internals = { version = "=0.8.0", default-features = false, path = "../serde_codegen_internals" }
syntex = { version = "^0.43.0", optional = true }
syntex_syntax = { version = "^0.43.0", optional = true }

View File

@ -1,6 +1,6 @@
[package]
name = "serde_codegen_internals"
version = "0.7.0"
version = "0.8.0"
authors = ["Erick Tryzelaar <erick.tryzelaar@gmail.com>"]
license = "MIT/Apache-2.0"
description = "AST representation used by Serde codegen. Unstable."
@ -17,5 +17,5 @@ with-syntex = ["syntex_syntax", "syntex_errors"]
[dependencies]
clippy = { version = "^0.*", optional = true }
syntex_syntax = { version = "^0.42.0", optional = true }
syntex_errors = { version = "^0.42.0", optional = true }
syntex_syntax = { version = "^0.43.0", optional = true }
syntex_errors = { version = "^0.43.0", optional = true }

View File

@ -8,8 +8,7 @@ use syntax::fold::Folder;
use syntax::parse::parser::{Parser, PathStyle};
use syntax::parse::token::{self, InternedString};
use syntax::parse;
use syntax::print::pprust::{lit_to_string, meta_item_to_string};
use syntax::ptr::P;
use syntax::print::pprust::{lit_to_string, meta_item_to_string, meta_list_item_to_string};
use syntax::tokenstream::{self, TokenTree};
// This module handles parsing of `#[serde(...)]` attributes. The entrypoints
@ -165,7 +164,7 @@ impl Item {
cx.span_err(
meta_item.span,
&format!("unknown serde container attribute `{}`",
meta_item_to_string(meta_item)));
meta_item_to_string(&meta_item)));
}
}
}
@ -236,7 +235,7 @@ impl Variant {
cx.span_err(
meta_item.span,
&format!("unknown serde variant attribute `{}`",
meta_item_to_string(meta_item)));
meta_item_to_string(&meta_item)));
}
}
}
@ -384,7 +383,7 @@ impl Field {
cx.span_err(
meta_item.span,
&format!("unknown serde field attribute `{}`",
meta_item_to_string(meta_item)));
meta_item_to_string(&meta_item)));
}
}
}
@ -454,7 +453,7 @@ type SerAndDe<T> = (Option<Spanned<T>>, Option<Spanned<T>>);
fn get_ser_and_de<T, F>(
cx: &ExtCtxt,
attribute: &'static str,
items: &[P<ast::MetaItem>],
items: &[ast::NestedMetaItem],
f: F
) -> Result<SerAndDe<T>, ()>
where F: Fn(&ExtCtxt, &str, &ast::Lit) -> Result<T, ()>,
@ -464,15 +463,29 @@ fn get_ser_and_de<T, F>(
for item in items {
match item.node {
ast::MetaItemKind::NameValue(ref name, ref lit) if name == &"serialize" => {
if let Ok(v) = f(cx, name, lit) {
ser_item.set(item.span, v);
}
}
ast::NestedMetaItemKind::MetaItem(ref meta_item) => {
match meta_item.node {
ast::MetaItemKind::NameValue(ref name, ref lit) if name == &"serialize" => {
if let Ok(v) = f(cx, name, lit) {
ser_item.set(item.span, v);
}
}
ast::MetaItemKind::NameValue(ref name, ref lit) if name == &"deserialize" => {
if let Ok(v) = f(cx, name, lit) {
de_item.set(item.span, v);
ast::MetaItemKind::NameValue(ref name, ref lit) if name == &"deserialize" => {
if let Ok(v) = f(cx, name, lit) {
de_item.set(item.span, v);
}
}
_ => {
cx.span_err(
item.span,
&format!("unknown {} attribute `{}`",
attribute,
meta_item_to_string(meta_item)));
return Err(());
}
}
}
@ -481,7 +494,7 @@ fn get_ser_and_de<T, F>(
item.span,
&format!("unknown {} attribute `{}`",
attribute,
meta_item_to_string(item)));
meta_list_item_to_string(item)));
return Err(());
}
@ -493,23 +506,30 @@ fn get_ser_and_de<T, F>(
fn get_renames(
cx: &ExtCtxt,
items: &[P<ast::MetaItem>],
items: &[ast::NestedMetaItem],
) -> Result<SerAndDe<InternedString>, ()> {
get_ser_and_de(cx, "rename", items, get_str_from_lit)
}
fn get_where_predicates(
cx: &ExtCtxt,
items: &[P<ast::MetaItem>],
items: &[ast::NestedMetaItem],
) -> Result<SerAndDe<Vec<ast::WherePredicate>>, ()> {
get_ser_and_de(cx, "bound", items, parse_lit_into_where)
}
pub fn get_serde_meta_items(attr: &ast::Attribute) -> Option<&[P<ast::MetaItem>]> {
pub fn get_serde_meta_items(attr: &ast::Attribute) -> Option<Vec<ast::MetaItem>> {
match attr.node.value.node {
ast::MetaItemKind::List(ref name, ref items) if name == &"serde" => {
attr::mark_used(attr);
Some(items)
Some(items.iter().filter_map(|item| {
match item.node {
ast::NestedMetaItemKind::MetaItem(ref meta_item) => {
Some((*meta_item.clone()).clone())
}
_ => None,
}
}).collect())
}
_ => None
}

View File

@ -1,6 +1,6 @@
[package]
name = "serde_macros"
version = "0.8.4"
version = "0.8.5"
authors = ["Erick Tryzelaar <erick.tryzelaar@gmail.com>"]
license = "MIT/Apache-2.0"
description = "Macros to auto-generate implementations for the serde framework"
@ -23,14 +23,14 @@ unstable-testing = [
[dependencies]
clippy = { version = "^0.*", optional = true }
serde_codegen = { version = "=0.8.4", default-features = false, features = ["unstable"], path = "../serde_codegen" }
serde_codegen = { version = "=0.8.5", default-features = false, features = ["unstable"], path = "../serde_codegen" }
[dev-dependencies]
compiletest_rs = "^0.2.0"
fnv = "1.0"
rustc-serialize = "^0.3.16"
serde = { version = "0.8.4", path = "../serde" }
serde_test = { version = "0.8.4", path = "../serde_test" }
serde = { version = "0.8.5", path = "../serde" }
serde_test = { version = "0.8.5", path = "../serde_test" }
[[test]]
name = "test"

View File

@ -1,6 +1,6 @@
[package]
name = "serde_test"
version = "0.8.4"
version = "0.8.5"
authors = ["Erick Tryzelaar <erick.tryzelaar@gmail.com>"]
license = "MIT/Apache-2.0"
description = "Token De/Serializer for testing De/Serialize implementations"
@ -12,4 +12,4 @@ keywords = ["serde", "serialization"]
include = ["Cargo.toml", "src/**/*.rs"]
[dependencies]
serde = { version = "0.8.4", path = "../serde" }
serde = { version = "0.8.5", path = "../serde" }

View File

@ -1,6 +1,6 @@
[package]
name = "serde_testing"
version = "0.8.4"
version = "0.8.5"
authors = ["Erick Tryzelaar <erick.tryzelaar@gmail.com>"]
license = "MIT/Apache-2.0"
description = "A generic serialization/deserialization framework"