Place compile-fail expected errors on their own line

This commit is contained in:
David Tolnay 2018-06-02 22:19:39 -07:00
parent 57de28744c
commit a4acc83282
No known key found for this signature in database
GPG Key ID: F9BA143B95FF6D82
67 changed files with 140 additions and 70 deletions

View File

@ -9,9 +9,10 @@
#[macro_use]
extern crate serde_derive;
#[derive(Deserialize)] //~ ERROR: 12:10: 12:21: failed to parse borrowed lifetimes: "zzz"
#[derive(Deserialize)]
struct Test<'a> {
#[serde(borrow = "zzz")]
//~^^^ ERROR: failed to parse borrowed lifetimes: "zzz"
s: &'a str,
}

View File

@ -9,9 +9,10 @@
#[macro_use]
extern crate serde_derive;
#[derive(Deserialize)] //~ ERROR: 12:10: 12:21: duplicate borrowed lifetime `'a`
#[derive(Deserialize)]
struct Test<'a> {
#[serde(borrow = "'a + 'a")]
//~^^^ ERROR: duplicate borrowed lifetime `'a`
s: &'a str,
}

View File

@ -12,9 +12,10 @@ extern crate serde_derive;
#[derive(Deserialize)]
struct Str<'a>(&'a str);
#[derive(Deserialize)] //~ ERROR: 15:10: 15:21: duplicate serde attribute `borrow`
#[derive(Deserialize)]
enum Test<'a> {
#[serde(borrow)]
//~^^^ ERROR: duplicate serde attribute `borrow`
S(#[serde(borrow)] Str<'a>)
}

View File

@ -9,9 +9,10 @@
#[macro_use]
extern crate serde_derive;
#[derive(Deserialize)] //~ ERROR: 12:10: 12:21: at least one lifetime must be borrowed
#[derive(Deserialize)]
struct Test<'a> {
#[serde(borrow = "")]
//~^^^ ERROR: at least one lifetime must be borrowed
s: &'a str,
}

View File

@ -9,9 +9,10 @@
#[macro_use]
extern crate serde_derive;
#[derive(Deserialize)] //~ ERROR: 12:10: 12:21: field `s` has no lifetimes to borrow
#[derive(Deserialize)]
struct Test {
#[serde(borrow)]
//~^^^ ERROR: field `s` has no lifetimes to borrow
s: String,
}

View File

@ -12,9 +12,10 @@ extern crate serde_derive;
#[derive(Deserialize)]
struct Str<'a>(&'a str);
#[derive(Deserialize)] //~ ERROR: 15:10: 15:21: #[serde(borrow)] may only be used on newtype variants
#[derive(Deserialize)]
enum Test<'a> {
#[serde(borrow)]
//~^^^ ERROR: #[serde(borrow)] may only be used on newtype variants
S { s: Str<'a> }
}

View File

@ -9,9 +9,10 @@
#[macro_use]
extern crate serde_derive;
#[derive(Deserialize)] //~ ERROR: 12:10: 12:21: field `s` does not have lifetime 'b
#[derive(Deserialize)]
struct Test<'a> {
#[serde(borrow = "'b")]
//~^^^ ERROR: field `s` does not have lifetime 'b
s: &'a str,
}

View File

@ -9,8 +9,9 @@
#[macro_use]
extern crate serde_derive;
#[derive(Serialize)] //~ ERROR: 12:10: 12:19: enum tags `conflict` for type and content conflict with each other
#[derive(Serialize)]
#[serde(tag = "conflict", content = "conflict")]
//~^^ ERROR: enum tags `conflict` for type and content conflict with each other
enum E {
A,
B,

View File

@ -9,7 +9,8 @@
#[macro_use]
extern crate serde_derive;
#[derive(Serialize)] //~ ERROR: 12:10: 12:19: #[serde(flatten)] cannot be used on newtype structs
#[derive(Serialize)]
struct Foo(#[serde(flatten)] HashMap<String, String>);
//~^^ ERROR: #[serde(flatten)] cannot be used on newtype structs
fn main() {}

View File

@ -9,9 +9,10 @@
#[macro_use]
extern crate serde_derive;
#[derive(Deserialize)] //~ ERROR: 12:10: 12:21: #[serde(flatten] can not be combined with #[serde(skip_deserializing)]
#[derive(Deserialize)]
struct Foo {
#[serde(flatten, skip_deserializing)]
//~^^^ ERROR: #[serde(flatten] can not be combined with #[serde(skip_deserializing)]
other: Other,
}

View File

@ -9,9 +9,10 @@
#[macro_use]
extern crate serde_derive;
#[derive(Serialize)] //~ ERROR: 12:10: 12:19: #[serde(flatten] can not be combined with #[serde(skip_serializing_if = "...")]
#[derive(Serialize)]
struct Foo {
#[serde(flatten, skip_serializing_if="Option::is_none")]
//~^^^ ERROR: #[serde(flatten] can not be combined with #[serde(skip_serializing_if = "...")]
other: Option<Other>,
}

View File

@ -9,9 +9,10 @@
#[macro_use]
extern crate serde_derive;
#[derive(Serialize)] //~ ERROR: 12:10: 12:19: #[serde(flatten] can not be combined with #[serde(skip_serializing)]
#[derive(Serialize)]
struct Foo {
#[serde(flatten, skip_serializing)]
//~^^^ ERROR: #[serde(flatten] can not be combined with #[serde(skip_serializing)]
other: Other,
}

View File

@ -9,7 +9,8 @@
#[macro_use]
extern crate serde_derive;
#[derive(Serialize)] //~ ERROR: 12:10: 12:19: #[serde(flatten)] cannot be used on tuple structs
#[derive(Serialize)]
struct Foo(u32, #[serde(flatten)] HashMap<String, String>);
//~^^ ERROR: #[serde(flatten)] cannot be used on tuple structs
fn main() {}

View File

@ -9,8 +9,9 @@
#[macro_use]
extern crate serde_derive;
#[derive(Serialize)] //~ ERROR: 12:10: 12:19: variant field name `conflict` conflicts with internal tag
#[derive(Serialize)]
#[serde(tag = "conflict")]
//~^^ ERROR: variant field name `conflict` conflicts with internal tag
enum E {
A {
#[serde(rename = "conflict")]

View File

@ -9,8 +9,9 @@
#[macro_use]
extern crate serde_derive;
#[derive(Deserialize)] //~ ERROR: 12:10: 12:21: #[serde(default)] can only be used on structs with named fields
#[derive(Deserialize)]
#[serde(default)]
//~^^ ERROR: #[serde(default)] can only be used on structs
enum E {
S { f: u8 },
}

View File

@ -9,8 +9,9 @@
#[macro_use]
extern crate serde_derive;
#[derive(Deserialize)] //~ ERROR: 12:10: 12:21: #[serde(default)] can only be used on structs with named fields
#[derive(Deserialize)]
#[serde(default)]
//~^^ ERROR: #[serde(default)] can only be used on structs
struct T(u8, u8);
fn main() { }

View File

@ -9,9 +9,10 @@
#[macro_use]
extern crate serde_derive;
#[derive(Serialize)] //~ ERROR: 12:10: 12:19: unknown serde field attribute `serialize`
#[derive(Serialize)]
struct S {
#[serde(rename="x", serialize="y")]
//~^^^ ERROR: unknown serde field attribute `serialize`
x: (),
}

View File

@ -9,10 +9,11 @@
#[macro_use]
extern crate serde_derive;
#[derive(Serialize)] //~ ERROR: 12:10: 12:19: duplicate serde attribute `rename`
#[derive(Serialize)]
struct S {
#[serde(rename="x")]
#[serde(rename(deserialize="y"))]
//~^^^^ ERROR: duplicate serde attribute `rename`
x: (),
}

View File

@ -9,9 +9,10 @@
#[macro_use]
extern crate serde_derive;
#[derive(Serialize)] //~ ERROR: 12:10: 12:19: duplicate serde attribute `rename`
#[derive(Serialize)]
struct S {
#[serde(rename(serialize="x"), rename(serialize="y"))]
//~^^^ ERROR: duplicate serde attribute `rename`
x: (),
}

View File

@ -9,10 +9,11 @@
#[macro_use]
extern crate serde_derive;
#[derive(Serialize)] //~ ERROR: 12:10: 12:19: duplicate serde attribute `rename`
#[derive(Serialize)]
struct S {
#[serde(rename(serialize="x"))]
#[serde(rename="y")]
//~^^^^ ERROR: duplicate serde attribute `rename`
x: (),
}

View File

@ -9,9 +9,10 @@
#[macro_use]
extern crate serde_derive;
#[derive(Serialize)] //~ ERROR: 12:10: 12:19: duplicate serde attribute `rename`
#[derive(Serialize)]
struct S {
#[serde(rename(serialize="x", serialize="y"))]
//~^^^ ERROR: duplicate serde attribute `rename`
x: (),
}

View File

@ -9,10 +9,11 @@
#[macro_use]
extern crate serde_derive;
#[derive(Serialize)] //~ ERROR: 12:10: 12:19: duplicate serde attribute `rename`
#[derive(Serialize)]
struct S {
#[serde(rename(serialize="x"))]
#[serde(rename(serialize="y"))]
//~^^^^ ERROR: duplicate serde attribute `rename`
x: (),
}

View File

@ -9,9 +9,10 @@
#[macro_use]
extern crate serde_derive;
#[derive(Serialize)] //~ ERROR: 12:10: 12:19: duplicate serde attribute `serialize_with`
#[derive(Serialize)]
struct S {
#[serde(with = "w", serialize_with = "s")]
//~^^^ ERROR: duplicate serde attribute `serialize_with`
x: (),
}

View File

@ -9,8 +9,9 @@
#[macro_use]
extern crate serde_derive;
#[derive(Serialize)] //~ ERROR: 12:10: 12:19: #[serde(tag = "...")] cannot be used with tuple variants
#[derive(Serialize)]
#[serde(tag = "type")]
//~^^ ERROR: #[serde(tag = "...")] cannot be used with tuple variants
enum E {
Tuple(u8, u8),
}

View File

@ -9,8 +9,9 @@
#[macro_use]
extern crate serde_derive;
#[derive(Serialize)] //~ ERROR: 12:10: 12:19: #[serde(tag = "...")] can only be used on enums
#[derive(Serialize)]
#[serde(tag = "type")]
//~^^ ERROR: #[serde(tag = "...")] can only be used on enums
struct S;
fn main() {}

View File

@ -9,9 +9,10 @@
#[macro_use]
extern crate serde_derive;
#[derive(Serialize)] //~ ERROR: 12:10: 12:19: enum cannot be both untagged and internally tagged
#[derive(Serialize)]
#[serde(untagged)]
#[serde(tag = "type")]
//~^^^ ERROR: enum cannot be both untagged and internally tagged
enum E {
A(u8),
B(String),

View File

@ -9,8 +9,9 @@
#[macro_use]
extern crate serde_derive;
#[derive(Serialize)] //~ ERROR: 12:10: 12:19: #[serde(untagged)] can only be used on enums
#[derive(Serialize)]
#[serde(untagged)]
//~^^ ERROR: #[serde(untagged)] can only be used on enums
struct S;
fn main() {}

View File

@ -9,8 +9,9 @@
#[macro_use]
extern crate serde_derive;
#[derive(Deserialize)] //~ ERROR: 12:10: 12:21: `field_identifier` and `variant_identifier` cannot both be set
#[derive(Deserialize)]
#[serde(field_identifier, variant_identifier)]
//~^^ ERROR: `field_identifier` and `variant_identifier` cannot both be set
enum F {
A,
B,

View File

@ -9,8 +9,9 @@
#[macro_use]
extern crate serde_derive;
#[derive(Deserialize)] //~ ERROR: 12:10: 12:21: `field_identifier` can only be used on an enum
#[derive(Deserialize)]
#[serde(field_identifier)]
//~^^ ERROR: `field_identifier` can only be used on an enum
struct S;
fn main() {}

View File

@ -9,11 +9,12 @@
#[macro_use]
extern crate serde_derive;
#[derive(Deserialize)] //~ ERROR: 12:10: 12:21: field_identifier may only contain unit variants
#[derive(Deserialize)]
#[serde(field_identifier)]
enum F {
A,
B(u8, u8),
//~^^^^^ ERROR: field_identifier may only contain unit variants
}
fn main() {}

View File

@ -9,11 +9,12 @@
#[macro_use]
extern crate serde_derive;
#[derive(Deserialize)] //~ ERROR: 12:10: 12:21: `Other` must be the last variant
#[derive(Deserialize)]
#[serde(field_identifier)]
enum F {
A,
Other(String),
//~^^^^^ ERROR: `Other` must be the last variant
B,
}

View File

@ -9,10 +9,11 @@
#[macro_use]
extern crate serde_derive;
#[derive(Deserialize)] //~ ERROR: 12:10: 12:21: #[serde(other)] may only be used inside a field_identifier
#[derive(Deserialize)]
enum F {
A,
#[serde(other)]
//~^^^^ ERROR: #[serde(other)] may only be used inside a field_identifier
B,
}

View File

@ -9,11 +9,12 @@
#[macro_use]
extern crate serde_derive;
#[derive(Deserialize)] //~ ERROR: 12:10: 12:21: #[serde(other)] must be on a unit variant
#[derive(Deserialize)]
#[serde(field_identifier)]
enum F {
A,
#[serde(other)]
//~^^^^^ ERROR: #[serde(other)] must be on a unit variant
Other(u8, u8),
}

View File

@ -9,11 +9,12 @@
#[macro_use]
extern crate serde_derive;
#[derive(Deserialize)] //~ ERROR: 12:10: 12:21: #[serde(other)] must be the last variant
#[derive(Deserialize)]
#[serde(field_identifier)]
enum F {
A,
#[serde(other)]
//~^^^^^ ERROR: #[serde(other)] must be the last variant
Other,
B,
}

View File

@ -9,8 +9,9 @@
#[macro_use]
extern crate serde_derive;
#[derive(Serialize)] //~ ERROR: 12:10: 12:19: field identifiers cannot be serialized
#[derive(Serialize)]
#[serde(field_identifier)]
//~^^ ERROR: field identifiers cannot be serialized
enum F {
A,
B,

View File

@ -9,8 +9,9 @@
#[macro_use]
extern crate serde_derive;
#[derive(Deserialize)] //~ ERROR: 12:10: 12:21: `variant_identifier` can only be used on an enum
#[derive(Deserialize)]
#[serde(variant_identifier)]
//~^^ ERROR: `variant_identifier` can only be used on an enum
struct S;
fn main() {}

View File

@ -9,11 +9,12 @@
#[macro_use]
extern crate serde_derive;
#[derive(Deserialize)] //~ ERROR: 12:10: 12:21: variant_identifier may only contain unit variants
#[derive(Deserialize)]
#[serde(variant_identifier)]
enum F {
A,
B(u8, u8),
//~^^^^^ ERROR: variant_identifier may only contain unit variants
}
fn main() {}

View File

@ -9,7 +9,8 @@
#[macro_use]
extern crate serde_derive;
#[derive(Deserialize)] //~ ERROR: 12:10: 12:21: cannot deserialize when there is a lifetime parameter called 'de
#[derive(Deserialize)]
struct S<'de> {
//~^^ ERROR: cannot deserialize when there is a lifetime parameter called 'de
s: &'de str,
}

View File

@ -9,8 +9,9 @@
#[macro_use]
extern crate serde_derive;
#[derive(Deserialize)] //~ ERROR: 12:10: 12:21: cannot deserialize a dynamically sized struct
#[derive(Deserialize)]
struct S {
string: String,
slice: [u8],
//~^^^^ ERROR: cannot deserialize a dynamically sized struct
}

View File

@ -15,10 +15,11 @@ mod remote {
}
}
#[derive(Serialize)] //~ ERROR: 18:10: 18:19: failed to parse path: "~~~"
#[derive(Serialize)]
#[serde(remote = "remote::S")]
struct S {
#[serde(getter = "~~~")]
//~^^^^ ERROR: failed to parse path: "~~~"
a: u8,
}

View File

@ -15,8 +15,9 @@ mod remote {
}
}
#[derive(Serialize)] //~ ERROR: 18:10: 18:19: failed to parse path: "~~~"
#[derive(Serialize)]
#[serde(remote = "~~~")]
//~^^ ERROR: failed to parse path: "~~~"
struct S {
a: u8,
}

View File

@ -15,11 +15,12 @@ mod remote {
}
}
#[derive(Serialize)] //~ ERROR: 18:10: 18:19: #[serde(getter = "...")] is not allowed in an enum
#[derive(Serialize)]
#[serde(remote = "remote::E")]
pub enum E {
A {
#[serde(getter = "get_a")]
//~^^^^^ ERROR: #[serde(getter = "...")] is not allowed in an enum
a: u8,
}
}

View File

@ -19,7 +19,8 @@ mod remote {
#[derive(Serialize, Deserialize)]
#[serde(remote = "remote::S")]
struct S {
a: u8, //~^^^ ERROR: missing field `b` in initializer of `remote::S`
a: u8,
//~^^^^ ERROR: missing field `b` in initializer of `remote::S`
}
fn main() {}

View File

@ -9,9 +9,10 @@
#[macro_use]
extern crate serde_derive;
#[derive(Serialize)] //~ ERROR: 12:10: 12:19: #[serde(getter = "...")] can only be used in structs that have #[serde(remote = "...")]
#[derive(Serialize)]
struct S {
#[serde(getter = "S::get")]
//~^^^ ERROR: #[serde(getter = "...")] can only be used in structs that have #[serde(remote = "...")]
a: u8,
}

View File

@ -19,7 +19,8 @@ mod remote {
#[serde(remote = "remote::S")]
struct S {
//~^^^ ERROR: struct `remote::S` has no field named `b`
b: u8, //~^^^^ ERROR: no field `b` on type `&remote::S`
b: u8,
//~^^^^^ ERROR: no field `b` on type `&remote::S`
}
fn main() {}

View File

@ -13,8 +13,10 @@ mod remote {
pub struct S(pub u16);
}
#[derive(Deserialize)] //~ ERROR: mismatched types
#[derive(Deserialize)]
#[serde(remote = "remote::S")]
struct S(u8); //~^^ expected u16, found u8
struct S(u8);
//~^^^ ERROR: mismatched types
//~^^^^ expected u16, found u8
fn main() {}

View File

@ -21,11 +21,13 @@ mod remote {
}
}
#[derive(Serialize)] //~ ERROR: mismatched types
#[derive(Serialize)]
#[serde(remote = "remote::S")]
struct S {
#[serde(getter = "remote::S::get")]
a: u8, //~^^^^ expected u8, found u16
//~^^^^ ERROR: mismatched types
a: u8,
//~^^^^^^ expected u8, found u16
}
fn main() {}

View File

@ -15,10 +15,12 @@ mod remote {
}
}
#[derive(Serialize)] //~ ERROR: mismatched types
#[derive(Serialize)]
#[serde(remote = "remote::S")]
struct S {
a: u8, //~^^^ expected u8, found u16
a: u8,
//~^^^^ ERROR: mismatched types
//~^^^^^ expected u8, found u16
}
fn main() {}

View File

@ -9,8 +9,9 @@
#[macro_use]
extern crate serde_derive;
#[derive(Serialize)] //~ ERROR: 12:10: 12:19: #[serde(transparent)] requires struct to have at most one transparent field
#[derive(Serialize)]
#[serde(transparent)]
//~^^ ERROR: #[serde(transparent)] requires struct to have at most one transparent field
struct S {
a: u8,
b: u8,

View File

@ -9,8 +9,9 @@
#[macro_use]
extern crate serde_derive;
#[derive(Deserialize)] //~ ERROR: 12:10: 12:21: #[serde(transparent)] requires at least one field that is neither skipped nor has a default
#[derive(Deserialize)]
#[serde(transparent)]
//~^^ ERROR: #[serde(transparent)] requires at least one field that is neither skipped nor has a default
struct S {
#[serde(skip)]
a: u8,

View File

@ -9,8 +9,9 @@
#[macro_use]
extern crate serde_derive;
#[derive(Serialize)] //~ ERROR: 12:10: 12:19: #[serde(transparent)] requires at least one field that is not skipped
#[derive(Serialize)]
#[serde(transparent)]
//~^^ ERROR: #[serde(transparent)] requires at least one field that is not skipped
struct S {
#[serde(skip)]
a: u8,

View File

@ -9,8 +9,9 @@
#[macro_use]
extern crate serde_derive;
#[derive(Deserialize)] //~ ERROR: 12:10: 12:21: failed to parse type: from = "Option<T"
#[derive(Deserialize)]
#[serde(from = "Option<T")]
//~^^ ERROR: failed to parse type: from = "Option<T"
enum TestOne {
Testing,
One,

View File

@ -9,8 +9,9 @@
#[macro_use]
extern crate serde_derive;
#[derive(Serialize)] //~ ERROR: 12:10: 12:19: failed to parse type: into = "Option<T"
#[derive(Serialize)]
#[serde(into = "Option<T")]
//~^^ ERROR: failed to parse type: into = "Option<T"
enum TestOne {
Testing,
One,

View File

@ -9,8 +9,9 @@
#[macro_use]
extern crate serde_derive;
#[derive(Serialize)] //~ ERROR: 12:10: 12:19: unknown serde container attribute `abc`
#[derive(Serialize)]
#[serde(abc="xyz")]
//~^^ ERROR: unknown serde container attribute `abc`
struct A {
x: u32,
}

View File

@ -9,9 +9,10 @@
#[macro_use]
extern crate serde_derive;
#[derive(Serialize)] //~ ERROR: 12:10: 12:19: unknown serde field attribute `abc`
#[derive(Serialize)]
struct C {
#[serde(abc="xyz")]
//~^^^ ERROR: unknown serde field attribute `abc`
x: u32,
}

View File

@ -9,9 +9,10 @@
#[macro_use]
extern crate serde_derive;
#[derive(Serialize)] //~ ERROR: 12:10: 12:19: unknown serde variant attribute `abc`
#[derive(Serialize)]
enum E {
#[serde(abc="xyz")]
//~^^^ ERROR: unknown serde variant attribute `abc`
V,
}

View File

@ -9,9 +9,10 @@
#[macro_use]
extern crate serde_derive;
#[derive(Deserialize)] //~ ERROR: 12:10: 12:21: variant `Newtype` cannot have both #[serde(deserialize_with)] and a field 0 marked with #[serde(skip_deserializing)]
#[derive(Deserialize)]
enum Enum {
#[serde(deserialize_with = "deserialize_some_newtype_variant")]
//~^^^ ERROR: variant `Newtype` cannot have both #[serde(deserialize_with)] and a field 0 marked with #[serde(skip_deserializing)]
Newtype(#[serde(skip_deserializing)] String),
}

View File

@ -9,9 +9,10 @@
#[macro_use]
extern crate serde_derive;
#[derive(Deserialize)] //~ ERROR: 12:10: 12:21: variant `Struct` cannot have both #[serde(deserialize_with)] and a field `f1` marked with #[serde(skip_deserializing)]
#[derive(Deserialize)]
enum Enum {
#[serde(deserialize_with = "deserialize_some_other_variant")]
//~^^^ ERROR: variant `Struct` cannot have both #[serde(deserialize_with)] and a field `f1` marked with #[serde(skip_deserializing)]
Struct {
#[serde(skip_deserializing)]
f1: String,

View File

@ -9,9 +9,10 @@
#[macro_use]
extern crate serde_derive;
#[derive(Deserialize)] //~ ERROR: 12:10: 12:21: variant `Tuple` cannot have both #[serde(deserialize_with)] and a field 0 marked with #[serde(skip_deserializing)]
#[derive(Deserialize)]
enum Enum {
#[serde(deserialize_with = "deserialize_some_other_variant")]
//~^^^ ERROR: variant `Tuple` cannot have both #[serde(deserialize_with)] and a field 0 marked with #[serde(skip_deserializing)]
Tuple(#[serde(skip_deserializing)] String, u8),
}

View File

@ -9,10 +9,11 @@
#[macro_use]
extern crate serde_derive;
#[derive(Deserialize)] //~ ERROR: 12:10: 12:21: variant `Unit` cannot have both #[serde(deserialize_with)] and #[serde(skip_deserializing)]
#[derive(Deserialize)]
enum Enum {
#[serde(deserialize_with = "deserialize_some_unit_variant")]
#[serde(skip_deserializing)]
//~^^^^ ERROR: variant `Unit` cannot have both #[serde(deserialize_with)] and #[serde(skip_deserializing)]
Unit,
}

View File

@ -9,9 +9,10 @@
#[macro_use]
extern crate serde_derive;
#[derive(Serialize)] //~ ERROR: 12:10: 12:19: variant `Newtype` cannot have both #[serde(serialize_with)] and a field 0 marked with #[serde(skip_serializing)]
#[derive(Serialize)]
enum Enum {
#[serde(serialize_with = "serialize_some_newtype_variant")]
//~^^^ ERROR: variant `Newtype` cannot have both #[serde(serialize_with)] and a field 0 marked with #[serde(skip_serializing)]
Newtype(#[serde(skip_serializing)] String),
}

View File

@ -9,9 +9,10 @@
#[macro_use]
extern crate serde_derive;
#[derive(Serialize)] //~ ERROR: 12:10: 12:19: variant `Newtype` cannot have both #[serde(serialize_with)] and a field 0 marked with #[serde(skip_serializing_if)]
#[derive(Serialize)]
enum Enum {
#[serde(serialize_with = "serialize_some_newtype_variant")]
//~^^^ ERROR: variant `Newtype` cannot have both #[serde(serialize_with)] and a field 0 marked with #[serde(skip_serializing_if)]
Newtype(#[serde(skip_serializing_if = "always")] String),
}

View File

@ -9,9 +9,10 @@
#[macro_use]
extern crate serde_derive;
#[derive(Serialize)] //~ ERROR: 12:10: 12:19: variant `Struct` cannot have both #[serde(serialize_with)] and a field `f1` marked with #[serde(skip_serializing)]
#[derive(Serialize)]
enum Enum {
#[serde(serialize_with = "serialize_some_other_variant")]
//~^^^ ERROR: variant `Struct` cannot have both #[serde(serialize_with)] and a field `f1` marked with #[serde(skip_serializing)]
Struct {
#[serde(skip_serializing)]
f1: String,

View File

@ -9,9 +9,10 @@
#[macro_use]
extern crate serde_derive;
#[derive(Serialize)] //~ ERROR: 12:10: 12:19: variant `Struct` cannot have both #[serde(serialize_with)] and a field `f1` marked with #[serde(skip_serializing_if)]
#[derive(Serialize)]
enum Enum {
#[serde(serialize_with = "serialize_some_newtype_variant")]
//~^^^ ERROR: variant `Struct` cannot have both #[serde(serialize_with)] and a field `f1` marked with #[serde(skip_serializing_if)]
Struct {
#[serde(skip_serializing_if = "always")]
f1: String,

View File

@ -9,9 +9,10 @@
#[macro_use]
extern crate serde_derive;
#[derive(Serialize)] //~ ERROR: 12:10: 12:19: variant `Tuple` cannot have both #[serde(serialize_with)] and a field 0 marked with #[serde(skip_serializing)]
#[derive(Serialize)]
enum Enum {
#[serde(serialize_with = "serialize_some_other_variant")]
//~^^^ ERROR: variant `Tuple` cannot have both #[serde(serialize_with)] and a field 0 marked with #[serde(skip_serializing)]
Tuple(#[serde(skip_serializing)] String, u8),
}

View File

@ -9,9 +9,10 @@
#[macro_use]
extern crate serde_derive;
#[derive(Serialize)] //~ ERROR: 12:10: 12:19: variant `Tuple` cannot have both #[serde(serialize_with)] and a field 0 marked with #[serde(skip_serializing_if)]
#[derive(Serialize)]
enum Enum {
#[serde(serialize_with = "serialize_some_other_variant")]
//~^^^ ERROR: variant `Tuple` cannot have both #[serde(serialize_with)] and a field 0 marked with #[serde(skip_serializing_if)]
Tuple(#[serde(skip_serializing_if = "always")] String, u8),
}

View File

@ -9,10 +9,11 @@
#[macro_use]
extern crate serde_derive;
#[derive(Serialize)] //~ ERROR: 12:10: 12:19: variant `Unit` cannot have both #[serde(serialize_with)] and #[serde(skip_serializing)]
#[derive(Serialize)]
enum Enum {
#[serde(serialize_with = "serialize_some_unit_variant")]
#[serde(skip_serializing)]
//~^^^^ ERROR: variant `Unit` cannot have both #[serde(serialize_with)] and #[serde(skip_serializing)]
Unit,
}