commit
22690cedc2
@ -21,6 +21,7 @@ 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" }
|
||||
|
@ -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() {}
|
11
serde_derive/tests/compile-fail/str_ref_deser.rs
Normal file
11
serde_derive/tests/compile-fail/str_ref_deser.rs
Normal file
@ -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() { }
|
12
serde_derive/tests/compile-fail/unknown-attribute/field.rs
Normal file
12
serde_derive/tests/compile-fail/unknown-attribute/field.rs
Normal file
@ -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() { }
|
12
serde_derive/tests/compile-fail/unknown-attribute/variant.rs
Normal file
12
serde_derive/tests/compile-fail/unknown-attribute/variant.rs
Normal file
@ -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.
|
@ -6,3 +6,5 @@ extern crate serde_derive;
|
||||
extern crate test;
|
||||
|
||||
include!("../../testing/tests/test.rs.in");
|
||||
|
||||
mod compile_tests;
|
||||
|
@ -1,2 +0,0 @@
|
||||
# To prevent compiletest from seeing two versions of serde
|
||||
paths = ["../serde"]
|
2
serde_macros/.gitignore
vendored
2
serde_macros/.gitignore
vendored
@ -1,2 +0,0 @@
|
||||
/target
|
||||
/Cargo.lock
|
@ -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"
|
@ -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");
|
@ -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() {}
|
@ -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;
|
Loading…
Reference in New Issue
Block a user