Error on duplicate attributes

This commit is contained in:
David Tolnay
2016-06-14 11:22:49 -07:00
parent 8e4da7f36b
commit 28589620f6
5 changed files with 199 additions and 129 deletions
@@ -0,0 +1,25 @@
#![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`
a: (), //~^ ERROR: duplicate serde attribute `rename`
//~^^ ERROR: duplicate serde attribute `rename`
#[serde(rename(serialize="x"))]
#[serde(rename="y")] //~ ERROR: duplicate serde attribute `rename`
b: (), //~^ ERROR: duplicate serde attribute `rename`
//~^^ ERROR: duplicate serde attribute `rename`
#[serde(rename(serialize="x"))]
#[serde(rename(deserialize="y"))] // ok
c: (),
#[serde(rename="x")]
#[serde(rename(deserialize="y"))] //~ ERROR: duplicate serde attribute `rename`
d: (), //~^ ERROR: duplicate serde attribute `rename`
} //~^^ ERROR: duplicate serde attribute `rename`
fn main() {}