serde/serde_macros/tests/compile-fail/duplicate_attributes.rs

33 lines
925 B
Rust
Raw Normal View History

2016-06-14 13:22:49 -05:00
#![feature(custom_attribute, custom_derive, plugin)]
#![plugin(serde_macros)]
#[derive(Serialize)]
struct S {
#[serde(rename(serialize="x"))]
#[serde(rename(serialize="y"))] //~ ERROR: duplicate serde attribute `rename`
2016-06-15 01:37:20 -05:00
a: (),
2016-06-14 13:22:49 -05:00
#[serde(rename(serialize="x"))]
#[serde(rename="y")] //~ ERROR: duplicate serde attribute `rename`
2016-06-15 01:37:20 -05:00
b: (),
2016-06-14 13:22:49 -05:00
#[serde(rename(serialize="x"))]
#[serde(rename(deserialize="y"))] // ok
c: (),
#[serde(rename="x")]
#[serde(rename(deserialize="y"))] //~ ERROR: duplicate serde attribute `rename`
2016-06-15 01:37:20 -05:00
d: (),
#[serde(rename(serialize="x", serialize="y"))] //~ ERROR: duplicate serde attribute `rename`
e: (),
#[serde(rename="x", serialize="y")] //~ ERROR: unknown serde field attribute `serialize = "y"`
f: (),
#[serde(rename(serialize="x"), rename(serialize="y"))] //~ ERROR: duplicate serde attribute `rename`
g: (),
2016-06-15 01:37:20 -05:00
}
2016-06-14 13:22:49 -05:00
fn main() {}