Compare commits

...

9 Commits

Author SHA1 Message Date
David Tolnay c61b20cceb Release 0.8.11 2016-10-03 13:38:52 -07:00
David Tolnay 42987a5b24 Fix break in quote 0.2.2 2016-10-03 13:37:46 -07:00
David Tolnay 3f28a93240 Update readme to serde_derive 2016-09-29 09:21:01 -07:00
David Tolnay 9970084550 Merge pull request #568 from tbu-/pr_ipaddr_stable
Allow the use of `IpAddr` implementations on stable
2016-09-29 08:58:33 -07:00
Tobias Bucher 3920993370 Allow the use of IpAddr implementations on stable
Also use the same strategy for serialization as for deserialization of
`IpAddr`.

Fixes #551.
2016-09-29 15:48:59 +02:00
David Tolnay 22690cedc2 Merge pull request #566 from serde-rs/del
Delete serde_macros
2016-09-28 13:32:02 -07:00
David Tolnay b27039d34d Compiletest error messages 2016-09-28 12:46:54 -07:00
David Tolnay 1b6fd5a362 Delete serde_macros 2016-09-28 11:59:25 -07:00
David Tolnay 8b7b886036 Test serde_derive instead of serde_macros 2016-09-28 11:19:27 -07:00
35 changed files with 165 additions and 182 deletions
+1 -1
View File
@@ -24,7 +24,7 @@ script:
- (cd serde && travis-cargo --only nightly build -- --no-default-features --features collections)
- (cd testing && travis-cargo --skip nightly test)
- (cd testing && travis-cargo --only nightly test -- --features unstable-testing)
- (cd serde_macros && travis-cargo --only nightly test -- --features unstable-testing)
- (cd serde_derive && travis-cargo --only nightly test)
- (cd examples/serde-syntex-example && travis-cargo --skip nightly run)
- (cd examples/serde-syntex-example && travis-cargo --only nightly run -- --no-default-features --features unstable)
- (cd serde && travis-cargo --only stable doc)
+4 -2
View File
@@ -15,8 +15,10 @@ You may be looking for:
## Serde in action
```rust
#![feature(plugin, custom_derive)]
#![plugin(serde_macros)]
#![feature(rustc_macro)]
#[macro_use]
extern crate serde_derive;
extern crate serde_json;
+2 -2
View File
@@ -6,12 +6,12 @@ build = "build.rs"
[features]
default = ["serde_codegen"]
unstable = ["serde_macros"]
unstable = ["serde_derive"]
[build-dependencies]
serde_codegen = { version = "^0.8", optional = true, path = "../../serde_codegen" }
[dependencies]
serde = "^0.8"
serde_derive = { version = "^0.8", optional = true, path = "../../serde_derive" }
serde_json = "^0.8"
serde_macros = { version = "^0.8", optional = true, path = "../../serde_macros" }
+2 -2
View File
@@ -1,4 +1,4 @@
#[cfg(not(feature = "serde_macros"))]
#[cfg(not(feature = "serde_derive"))]
mod inner {
extern crate serde_codegen;
@@ -15,7 +15,7 @@ mod inner {
}
}
#[cfg(feature = "serde_macros")]
#[cfg(feature = "serde_derive")]
mod inner {
pub fn main() {}
}
+7 -4
View File
@@ -1,11 +1,14 @@
#![cfg_attr(feature = "serde_macros", feature(custom_derive, plugin))]
#![cfg_attr(feature = "serde_macros", plugin(serde_macros))]
#![cfg_attr(feature = "serde_derive", feature(rustc_macro))]
#[cfg(feature = "serde_derive")]
#[macro_use]
extern crate serde_derive;
extern crate serde;
extern crate serde_json;
#[cfg(feature = "serde_macros")]
#[cfg(feature = "serde_derive")]
include!("main.rs.in");
#[cfg(not(feature = "serde_macros"))]
#[cfg(not(feature = "serde_derive"))]
include!(concat!(env!("OUT_DIR"), "/main.rs"));
+1 -1
View File
@@ -1,6 +1,6 @@
[package]
name = "serde"
version = "0.8.10"
version = "0.8.11"
authors = ["Erick Tryzelaar <erick.tryzelaar@gmail.com>"]
license = "MIT/Apache-2.0"
description = "A generic serialization/deserialization framework"
+1 -1
View File
@@ -809,7 +809,7 @@ map_impl!(
///////////////////////////////////////////////////////////////////////////////
#[cfg(all(feature = "unstable", feature = "std"))]
#[cfg(feature = "std")]
impl Deserialize for net::IpAddr {
fn deserialize<D>(deserializer: &mut D) -> Result<Self, D::Error>
where D: Deserializer,
+2 -5
View File
@@ -640,15 +640,12 @@ impl Serialize for Duration {
///////////////////////////////////////////////////////////////////////////////
#[cfg(all(feature = "std", feature = "unstable"))]
#[cfg(feature = "std")]
impl Serialize for net::IpAddr {
fn serialize<S>(&self, serializer: &mut S) -> Result<(), S::Error>
where S: Serializer,
{
match *self {
net::IpAddr::V4(ref addr) => addr.serialize(serializer),
net::IpAddr::V6(ref addr) => addr.serialize(serializer),
}
self.to_string().serialize(serializer)
}
}
+1 -1
View File
@@ -1,6 +1,6 @@
[package]
name = "serde_codegen"
version = "0.8.10"
version = "0.8.11"
authors = ["Erick Tryzelaar <erick.tryzelaar@gmail.com>"]
license = "MIT/Apache-2.0"
description = "Macros to auto-generate implementations for the serde framework"
+8 -8
View File
@@ -651,14 +651,6 @@ fn deserialize_field_visitor(
Some(quote!(__ignore,))
};
let field_enum = quote! {
#[allow(non_camel_case_types)]
enum __Field {
#(field_idents,)*
#ignore_variant
}
};
let index_field_arms: Vec<_> = field_idents.iter()
.enumerate()
.map(|(field_index, field_ident)| {
@@ -745,6 +737,14 @@ fn deserialize_field_visitor(
}
};
let field_enum = quote! {
#[allow(non_camel_case_types)]
enum __Field {
#(field_idents,)*
#ignore_variant
}
};
let impl_item = quote! {
impl _serde::de::Deserialize for __Field {
#[inline]
+5 -4
View File
@@ -1,6 +1,6 @@
[package]
name = "serde_derive"
version = "0.8.10"
version = "0.8.11"
authors = ["Erick Tryzelaar <erick.tryzelaar@gmail.com>"]
license = "MIT/Apache-2.0"
description = "Macros 1.1 implementation of #[derive(Serialize, Deserialize)]"
@@ -15,12 +15,13 @@ name = "serde_derive"
rustc-macro = true
[dependencies.serde_codegen]
version = "=0.8.10"
version = "=0.8.11"
path = "../serde_codegen"
default-features = false
features = ["with-syn"]
[dev-dependencies]
compiletest_rs = "^0.2.0"
fnv = "1.0"
serde = { version = "0.8.10", path = "../serde" }
serde_test = { version = "0.8.10", path = "../serde_test" }
serde = { version = "0.8.11", path = "../serde" }
serde_test = { version = "0.8.11", path = "../serde_test" }
@@ -0,0 +1,12 @@
#![feature(rustc_macro)]
#[macro_use]
extern crate serde_derive;
#[derive(Serialize)] //~ ERROR: custom derive attribute panicked
struct S {
#[serde(rename="x", serialize="y")] //~^^ HELP: unknown serde field attribute `serialize`
x: (),
}
fn main() {}
@@ -0,0 +1,13 @@
#![feature(rustc_macro)]
#[macro_use]
extern crate serde_derive;
#[derive(Serialize)] //~ ERROR: custom derive attribute panicked
struct S {
#[serde(rename="x")]
#[serde(rename(deserialize="y"))] //~^^^ HELP: duplicate serde attribute `rename`
x: (),
}
fn main() {}
@@ -0,0 +1,12 @@
#![feature(rustc_macro)]
#[macro_use]
extern crate serde_derive;
#[derive(Serialize)] //~ ERROR: custom derive attribute panicked
struct S {
#[serde(rename(serialize="x"), rename(serialize="y"))] //~^^ HELP: duplicate serde attribute `rename`
x: (),
}
fn main() {}
@@ -0,0 +1,13 @@
#![feature(rustc_macro)]
#[macro_use]
extern crate serde_derive;
#[derive(Serialize)] //~ ERROR: custom derive attribute panicked
struct S {
#[serde(rename(serialize="x"))]
#[serde(rename="y")] //~^^^ HELP: duplicate serde attribute `rename`
x: (),
}
fn main() {}
@@ -0,0 +1,12 @@
#![feature(rustc_macro)]
#[macro_use]
extern crate serde_derive;
#[derive(Serialize)] //~ ERROR: custom derive attribute panicked
struct S {
#[serde(rename(serialize="x", serialize="y"))] //~^^ HELP: duplicate serde attribute `rename`
x: (),
}
fn main() {}
@@ -0,0 +1,13 @@
#![feature(rustc_macro)]
#[macro_use]
extern crate serde_derive;
#[derive(Serialize)] //~ ERROR: custom derive attribute panicked
struct S {
#[serde(rename(serialize="x"))]
#[serde(rename(serialize="y"))] //~^^^ HELP: duplicate serde attribute `rename`
x: (),
}
fn main() {}
@@ -0,0 +1,11 @@
#![feature(rustc_macro)]
#[macro_use]
extern crate serde_derive;
#[derive(Serialize, Deserialize)] //~ ERROR: custom derive attribute panicked
struct Test<'a> {
s: &'a str, //~^^ HELP: Serde does not support deserializing fields of type &str
}
fn main() {}
@@ -0,0 +1,12 @@
#![feature(rustc_macro)]
#[macro_use]
extern crate serde_derive;
#[derive(Serialize)] //~ ERROR: custom derive attribute panicked
#[serde(abc="xyz")] //~^ HELP: unknown serde container attribute `abc`
struct A {
x: u32,
}
fn main() { }
@@ -0,0 +1,12 @@
#![feature(rustc_macro)]
#[macro_use]
extern crate serde_derive;
#[derive(Serialize)] //~ ERROR: custom derive attribute panicked
struct C {
#[serde(abc="xyz")] //~^^ HELP: unknown serde field attribute `abc`
x: u32,
}
fn main() { }
@@ -0,0 +1,12 @@
#![feature(rustc_macro)]
#[macro_use]
extern crate serde_derive;
#[derive(Serialize)] //~ ERROR: custom derive attribute panicked
enum E {
#[serde(abc="xyz")] //~^^ HELP: unknown serde variant attribute `abc`
V,
}
fn main() { }
@@ -1,8 +1,9 @@
#![feature(custom_derive, plugin)]
#![plugin(serde_macros, clippy)]
#![feature(rustc_macro)]
#![deny(identity_op)]
#[macro_use]
extern crate serde_derive;
// The derived implementation uses 0+1 to add up the number of fields
// serialized, which Clippy warns about. If the expansion info is registered
// correctly, the Clippy lint is not triggered.
+2
View File
@@ -6,3 +6,5 @@ extern crate serde_derive;
extern crate test;
include!("../../testing/tests/test.rs.in");
mod compile_tests;
-2
View File
@@ -1,2 +0,0 @@
# To prevent compiletest from seeing two versions of serde
paths = ["../serde"]
-2
View File
@@ -1,2 +0,0 @@
/target
/Cargo.lock
-41
View File
@@ -1,41 +0,0 @@
[package]
name = "serde_macros"
version = "0.8.9"
authors = ["Erick Tryzelaar <erick.tryzelaar@gmail.com>"]
license = "MIT/Apache-2.0"
description = "Macros to auto-generate implementations for the serde framework"
homepage = "https://serde.rs"
repository = "https://github.com/serde-rs/serde"
documentation = "https://serde.rs/codegen.html"
keywords = ["serde", "serialization"]
include = ["Cargo.toml", "src/**/*.rs"]
[lib]
name = "serde_macros"
plugin = true
[features]
unstable-testing = [
"clippy",
"serde/unstable-testing",
"serde_codegen/unstable-testing"
]
[dependencies]
clippy = { version = "^0.*", optional = true }
serde_codegen = { version = "=0.8.9", 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.9", path = "../serde" }
serde_test = { version = "0.8.9", path = "../serde_test" }
[[test]]
name = "test"
path = "tests/test.rs"
[[bench]]
name = "bench"
path = "benches/bench.rs"
-9
View File
@@ -1,9 +0,0 @@
#![feature(custom_attribute, custom_derive, plugin, test)]
#![cfg_attr(feature = "clippy", plugin(clippy))]
#![plugin(serde_macros)]
extern crate rustc_serialize;
extern crate serde;
extern crate test;
include!("../../testing/benches/bench.rs.in");
-12
View File
@@ -1,12 +0,0 @@
#![feature(plugin_registrar, rustc_private)]
#![cfg_attr(feature = "clippy", feature(plugin))]
#![cfg_attr(feature = "clippy", plugin(clippy))]
extern crate serde_codegen;
extern crate rustc_plugin;
#[plugin_registrar]
#[doc(hidden)]
pub fn plugin_registrar(reg: &mut rustc_plugin::Registry) {
serde_codegen::register(reg);
}
@@ -1,32 +0,0 @@
#![feature(custom_attribute, custom_derive, plugin)]
#![plugin(serde_macros)]
#[derive(Serialize)] //~ ERROR: 6 errors:
struct S {
#[serde(rename(serialize="x"))]
#[serde(rename(serialize="y"))] // ERROR: duplicate serde attribute `rename`
a: (),
#[serde(rename(serialize="x"))]
#[serde(rename="y")] // ERROR: duplicate serde attribute `rename`
b: (),
#[serde(rename(serialize="x"))]
#[serde(rename(deserialize="y"))] // ok
c: (),
#[serde(rename="x")]
#[serde(rename(deserialize="y"))] // ERROR: duplicate serde attribute `rename`
d: (),
#[serde(rename(serialize="x", serialize="y"))] // ERROR: duplicate serde attribute `rename`
e: (),
#[serde(rename="x", serialize="y")] // ERROR: unknown serde field attribute `serialize`
f: (),
#[serde(rename(serialize="x"), rename(serialize="y"))] // ERROR: duplicate serde attribute `rename`
g: (),
}
fn main() {}
@@ -1,30 +0,0 @@
#![feature(custom_attribute, custom_derive, plugin)]
#![plugin(serde_macros)]
extern crate serde;
#[derive(Serialize)] //~ unknown serde container attribute `abc`
#[serde(abc="xyz")]
struct A {
x: u32,
}
#[derive(Deserialize)] //~ unknown serde container attribute `abc`
#[serde(abc="xyz")]
struct B {
x: u32,
}
#[derive(Serialize)] //~ unknown serde field attribute `abc`
struct C {
#[serde(abc="xyz")]
x: u32,
}
#[derive(Deserialize)] //~ unknown serde field attribute `abc`
struct D {
#[serde(abc="xyz")]
x: u32,
}
fn main() { }
@@ -1,9 +0,0 @@
#![feature(custom_attribute, custom_derive, plugin)]
#![plugin(serde_macros)]
#[derive(Serialize, Deserialize)] //~ ERROR: Serde does not support deserializing fields of type &str
struct Test<'a> {
s: &'a str,
}
fn main() {}
-8
View File
@@ -1,8 +0,0 @@
#![feature(test, custom_attribute, custom_derive, plugin)]
#![plugin(serde_macros)]
extern crate test;
include!("../../testing/tests/test.rs.in");
mod compile_tests;
+2 -2
View File
@@ -1,6 +1,6 @@
[package]
name = "serde_test"
version = "0.8.10"
version = "0.8.11"
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.10", path = "../serde" }
serde = { version = "0.8.11", path = "../serde" }
+1 -1
View File
@@ -1,6 +1,6 @@
[package]
name = "serde_testing"
version = "0.8.10"
version = "0.8.11"
authors = ["Erick Tryzelaar <erick.tryzelaar@gmail.com>"]
license = "MIT/Apache-2.0"
description = "A generic serialization/deserialization framework"