Move all compile-fail tests to ui tests

The update-references.sh script makes these much easier to update in
bulk compared to compile-fail tests.
This commit is contained in:
David Tolnay 2018-11-24 15:37:35 -08:00
parent b3d9d51b51
commit 4821d09a48
No known key found for this signature in database
GPG Key ID: F9BA143B95FF6D82
134 changed files with 603 additions and 73 deletions

View File

@ -11,10 +11,10 @@
extern crate compiletest_rs as compiletest;
#[test]
fn compile_fail() {
fn ui() {
let config = compiletest::Config {
mode: compiletest::common::Mode::CompileFail,
src_base: std::path::PathBuf::from("tests/compile-fail"),
mode: compiletest::common::Mode::Ui,
src_base: std::path::PathBuf::from("tests/ui"),
target_rustcflags: Some("-L deps/target/debug/deps".to_owned()),
..Default::default()
};

View File

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

View File

@ -0,0 +1,8 @@
error: failed to parse borrowed lifetimes: "zzz"
--> $DIR/bad_lifetimes.rs:12:10
|
12 | #[derive(Deserialize)]
| ^^^^^^^^^^^
error: aborting due to previous error

View File

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

View File

@ -0,0 +1,8 @@
error: duplicate borrowed lifetime `'a`
--> $DIR/duplicate_lifetime.rs:12:10
|
12 | #[derive(Deserialize)]
| ^^^^^^^^^^^
error: aborting due to previous error

View File

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

View File

@ -0,0 +1,8 @@
error: duplicate serde attribute `borrow`
--> $DIR/duplicate_variant.rs:15:10
|
15 | #[derive(Deserialize)]
| ^^^^^^^^^^^
error: aborting due to previous error

View File

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

View File

@ -0,0 +1,8 @@
error: at least one lifetime must be borrowed
--> $DIR/empty_lifetimes.rs:12:10
|
12 | #[derive(Deserialize)]
| ^^^^^^^^^^^
error: aborting due to previous error

View File

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

View File

@ -0,0 +1,8 @@
error: field `s` has no lifetimes to borrow
--> $DIR/no_lifetimes.rs:12:10
|
12 | #[derive(Deserialize)]
| ^^^^^^^^^^^
error: aborting due to previous error

View File

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

View File

@ -0,0 +1,8 @@
error: #[serde(borrow)] may only be used on newtype variants
--> $DIR/struct_variant.rs:15:10
|
15 | #[derive(Deserialize)]
| ^^^^^^^^^^^
error: aborting due to previous error

View File

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

View File

@ -0,0 +1,8 @@
error: field `s` does not have lifetime 'b
--> $DIR/wrong_lifetime.rs:12:10
|
12 | #[derive(Deserialize)]
| ^^^^^^^^^^^
error: aborting due to previous error

View File

@ -11,7 +11,6 @@ extern crate serde_derive;
#[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

@ -0,0 +1,8 @@
error: enum tags `conflict` for type and content conflict with each other
--> $DIR/adjacent-tag.rs:12:10
|
12 | #[derive(Serialize)]
| ^^^^^^^^^
error: aborting due to previous error

View File

@ -11,6 +11,5 @@ extern crate serde_derive;
#[derive(Serialize)]
struct Foo(#[serde(flatten)] HashMap<String, String>);
//~^^ ERROR: #[serde(flatten)] cannot be used on newtype structs
fn main() {}

View File

@ -0,0 +1,8 @@
error: #[serde(flatten)] cannot be used on newtype structs
--> $DIR/flatten-newtype-struct.rs:12:10
|
12 | #[derive(Serialize)]
| ^^^^^^^^^
error: aborting due to previous error

View File

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

View File

@ -0,0 +1,8 @@
error: #[serde(flatten] can not be combined with #[serde(skip_deserializing)]
--> $DIR/flatten-skip-deserializing.rs:12:10
|
12 | #[derive(Deserialize)]
| ^^^^^^^^^^^
error: aborting due to previous error

View File

@ -12,7 +12,6 @@ extern crate serde_derive;
#[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

@ -0,0 +1,8 @@
error: #[serde(flatten] can not be combined with #[serde(skip_serializing_if = "...")]
--> $DIR/flatten-skip-serializing-if.rs:12:10
|
12 | #[derive(Serialize)]
| ^^^^^^^^^
error: aborting due to previous error

View File

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

View File

@ -0,0 +1,8 @@
error: #[serde(flatten] can not be combined with #[serde(skip_serializing)]
--> $DIR/flatten-skip-serializing.rs:12:10
|
12 | #[derive(Serialize)]
| ^^^^^^^^^
error: aborting due to previous error

View File

@ -11,6 +11,5 @@ extern crate serde_derive;
#[derive(Serialize)]
struct Foo(u32, #[serde(flatten)] HashMap<String, String>);
//~^^ ERROR: #[serde(flatten)] cannot be used on tuple structs
fn main() {}

View File

@ -0,0 +1,8 @@
error: #[serde(flatten)] cannot be used on tuple structs
--> $DIR/flatten-tuple-struct.rs:12:10
|
12 | #[derive(Serialize)]
| ^^^^^^^^^
error: aborting due to previous error

View File

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

View File

@ -0,0 +1,8 @@
error: variant field name `conflict` conflicts with internal tag
--> $DIR/internal-tag.rs:12:10
|
12 | #[derive(Serialize)]
| ^^^^^^^^^
error: aborting due to previous error

View File

@ -11,7 +11,6 @@ extern crate serde_derive;
#[derive(Deserialize)]
#[serde(default)]
//~^^ ERROR: #[serde(default)] can only be used on structs
enum E {
S { f: u8 },
}

View File

@ -0,0 +1,8 @@
error: #[serde(default)] can only be used on structs with named fields
--> $DIR/enum.rs:12:10
|
12 | #[derive(Deserialize)]
| ^^^^^^^^^^^
error: aborting due to previous error

View File

@ -11,7 +11,6 @@ extern crate serde_derive;
#[derive(Deserialize)]
#[serde(default)]
//~^^ ERROR: #[serde(default)] can only be used on structs
struct T(u8, u8);
fn main() {}

View File

@ -0,0 +1,8 @@
error: #[serde(default)] can only be used on structs with named fields
--> $DIR/nameless_struct_fields.rs:12:10
|
12 | #[derive(Deserialize)]
| ^^^^^^^^^^^
error: aborting due to previous error

View File

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

View File

@ -0,0 +1,8 @@
error: unknown serde field attribute `serialize`
--> $DIR/rename-and-ser.rs:12:10
|
12 | #[derive(Serialize)]
| ^^^^^^^^^
error: aborting due to previous error

View File

@ -13,7 +13,6 @@ extern crate serde_derive;
struct S {
#[serde(rename = "x")]
#[serde(rename(deserialize = "y"))]
//~^^^^ ERROR: duplicate serde attribute `rename`
x: (),
}

View File

@ -0,0 +1,8 @@
error: duplicate serde attribute `rename`
--> $DIR/rename-rename-de.rs:12:10
|
12 | #[derive(Serialize)]
| ^^^^^^^^^
error: aborting due to previous error

View File

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

View File

@ -0,0 +1,8 @@
error: duplicate serde attribute `rename`
--> $DIR/rename-ser-rename-ser.rs:12:10
|
12 | #[derive(Serialize)]
| ^^^^^^^^^
error: aborting due to previous error

View File

@ -13,7 +13,6 @@ extern crate serde_derive;
struct S {
#[serde(rename(serialize = "x"))]
#[serde(rename = "y")]
//~^^^^ ERROR: duplicate serde attribute `rename`
x: (),
}

View File

@ -0,0 +1,8 @@
error: duplicate serde attribute `rename`
--> $DIR/rename-ser-rename.rs:12:10
|
12 | #[derive(Serialize)]
| ^^^^^^^^^
error: aborting due to previous error

View File

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

View File

@ -0,0 +1,8 @@
error: duplicate serde attribute `rename`
--> $DIR/rename-ser-ser.rs:12:10
|
12 | #[derive(Serialize)]
| ^^^^^^^^^
error: aborting due to previous error

View File

@ -13,7 +13,6 @@ extern crate serde_derive;
struct S {
#[serde(rename(serialize = "x"))]
#[serde(rename(serialize = "y"))]
//~^^^^ ERROR: duplicate serde attribute `rename`
x: (),
}

View File

@ -0,0 +1,8 @@
error: duplicate serde attribute `rename`
--> $DIR/two-rename-ser.rs:12:10
|
12 | #[derive(Serialize)]
| ^^^^^^^^^
error: aborting due to previous error

View File

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

View File

@ -0,0 +1,8 @@
error: duplicate serde attribute `serialize_with`
--> $DIR/with-and-serialize-with.rs:12:10
|
12 | #[derive(Serialize)]
| ^^^^^^^^^
error: aborting due to previous error

View File

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

View File

@ -0,0 +1,8 @@
error: #[serde(tag = "...")] cannot be used with tuple variants
--> $DIR/internal-tuple-variant.rs:12:10
|
12 | #[derive(Serialize)]
| ^^^^^^^^^
error: aborting due to previous error

View File

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

View File

@ -0,0 +1,8 @@
error: #[serde(tag = "...")] can only be used on enums
--> $DIR/internally-tagged-struct.rs:12:10
|
12 | #[derive(Serialize)]
| ^^^^^^^^^
error: aborting due to previous error

View File

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

View File

@ -0,0 +1,8 @@
error: enum cannot be both untagged and internally tagged
--> $DIR/untagged-and-internal.rs:12:10
|
12 | #[derive(Serialize)]
| ^^^^^^^^^
error: aborting due to previous error

View File

@ -11,7 +11,6 @@ extern crate serde_derive;
#[derive(Serialize)]
#[serde(untagged)]
//~^^ ERROR: #[serde(untagged)] can only be used on enums
struct S;
fn main() {}

View File

@ -0,0 +1,8 @@
error: #[serde(untagged)] can only be used on enums
--> $DIR/untagged-struct.rs:12:10
|
12 | #[derive(Serialize)]
| ^^^^^^^^^
error: aborting due to previous error

View File

@ -11,7 +11,6 @@ extern crate serde_derive;
#[derive(Deserialize)]
#[serde(field_identifier, variant_identifier)]
//~^^ ERROR: `field_identifier` and `variant_identifier` cannot both be set
enum F {
A,
B,

View File

@ -0,0 +1,8 @@
error: `field_identifier` and `variant_identifier` cannot both be set
--> $DIR/both.rs:12:10
|
12 | #[derive(Deserialize)]
| ^^^^^^^^^^^
error: aborting due to previous error

View File

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

View File

@ -0,0 +1,8 @@
error: `field_identifier` can only be used on an enum
--> $DIR/field_struct.rs:12:10
|
12 | #[derive(Deserialize)]
| ^^^^^^^^^^^
error: aborting due to previous error

View File

@ -14,7 +14,6 @@ extern crate serde_derive;
enum F {
A,
B(u8, u8),
//~^^^^^ ERROR: field_identifier may only contain unit variants
}
fn main() {}

View File

@ -0,0 +1,8 @@
error: field_identifier may only contain unit variants
--> $DIR/field_tuple.rs:12:10
|
12 | #[derive(Deserialize)]
| ^^^^^^^^^^^
error: aborting due to previous error

View File

@ -14,7 +14,6 @@ extern crate serde_derive;
enum F {
A,
Other(String),
//~^^^^^ ERROR: `Other` must be the last variant
B,
}

View File

@ -0,0 +1,8 @@
error: `Other` must be the last variant
--> $DIR/newtype_not_last.rs:12:10
|
12 | #[derive(Deserialize)]
| ^^^^^^^^^^^
error: aborting due to previous error

View File

@ -14,7 +14,6 @@ extern crate serde_derive;
enum F {
A,
#[serde(other)]
//~^^^^^ ERROR: #[serde(other)] must be on a unit variant
Other(u8, u8),
}

View File

@ -0,0 +1,8 @@
error: #[serde(other)] must be on a unit variant
--> $DIR/not_unit.rs:12:10
|
12 | #[derive(Deserialize)]
| ^^^^^^^^^^^
error: aborting due to previous error

View File

@ -14,7 +14,6 @@ extern crate serde_derive;
enum F {
A,
#[serde(other)]
//~^^^^^ ERROR: #[serde(other)] must be the last variant
Other,
B,
}

View File

@ -0,0 +1,8 @@
error: #[serde(other)] must be the last variant
--> $DIR/other_not_last.rs:12:10
|
12 | #[derive(Deserialize)]
| ^^^^^^^^^^^
error: aborting due to previous error

View File

@ -11,7 +11,6 @@ extern crate serde_derive;
#[derive(Serialize)]
#[serde(field_identifier)]
//~^^ ERROR: field identifiers cannot be serialized
enum F {
A,
B,

View File

@ -0,0 +1,8 @@
error: field identifiers cannot be serialized
--> $DIR/serialize.rs:12:10
|
12 | #[derive(Serialize)]
| ^^^^^^^^^
error: aborting due to previous error

View File

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

View File

@ -0,0 +1,8 @@
error: `variant_identifier` can only be used on an enum
--> $DIR/variant_struct.rs:12:10
|
12 | #[derive(Deserialize)]
| ^^^^^^^^^^^
error: aborting due to previous error

View File

@ -14,7 +14,6 @@ extern crate serde_derive;
enum F {
A,
B(u8, u8),
//~^^^^^ ERROR: variant_identifier may only contain unit variants
}
fn main() {}

View File

@ -0,0 +1,8 @@
error: variant_identifier may only contain unit variants
--> $DIR/variant_tuple.rs:12:10
|
12 | #[derive(Deserialize)]
| ^^^^^^^^^^^
error: aborting due to previous error

View File

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

View File

@ -0,0 +1,8 @@
error: cannot deserialize when there is a lifetime parameter called 'de
--> $DIR/deserialize_de_lifetime.rs:12:10
|
12 | #[derive(Deserialize)]
| ^^^^^^^^^^^
error: aborting due to previous error

View File

@ -13,5 +13,4 @@ extern crate serde_derive;
struct S {
string: String,
slice: [u8],
//~^^^^ ERROR: cannot deserialize a dynamically sized struct
}

View File

@ -0,0 +1,8 @@
error: cannot deserialize a dynamically sized struct
--> $DIR/deserialize_dst.rs:12:10
|
12 | #[derive(Deserialize)]
| ^^^^^^^^^^^
error: aborting due to previous error

View File

@ -19,7 +19,6 @@ mod remote {
#[serde(remote = "remote::S")]
struct S {
#[serde(getter = "~~~")]
//~^^^^ ERROR: failed to parse path: "~~~"
a: u8,
}

View File

@ -0,0 +1,8 @@
error: failed to parse path: "~~~"
--> $DIR/bad_getter.rs:18:10
|
18 | #[derive(Serialize)]
| ^^^^^^^^^
error: aborting due to previous error

View File

@ -17,7 +17,6 @@ mod remote {
#[derive(Serialize)]
#[serde(remote = "~~~")]
//~^^ ERROR: failed to parse path: "~~~"
struct S {
a: u8,
}

View File

@ -0,0 +1,8 @@
error: failed to parse path: "~~~"
--> $DIR/bad_remote.rs:18:10
|
18 | #[derive(Serialize)]
| ^^^^^^^^^
error: aborting due to previous error

View File

@ -20,7 +20,6 @@ mod remote {
pub enum E {
A {
#[serde(getter = "get_a")]
//~^^^^^ ERROR: #[serde(getter = "...")] is not allowed in an enum
a: u8,
},
}

View File

@ -0,0 +1,8 @@
error: #[serde(getter = "...")] is not allowed in an enum
--> $DIR/enum_getter.rs:18:10
|
18 | #[derive(Serialize)]
| ^^^^^^^^^
error: aborting due to previous error

View File

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

View File

@ -0,0 +1,9 @@
error[E0063]: missing field `b` in initializer of `remote::S`
--> $DIR/missing_field.rs:20:18
|
20 | #[serde(remote = "remote::S")]
| ^^^^^^^^^^^ missing `b`
error: aborting due to previous error
For more information about this error, try `rustc --explain E0063`.

View File

@ -12,7 +12,6 @@ extern crate serde_derive;
#[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

@ -0,0 +1,8 @@
error: #[serde(getter = "...")] can only be used in structs that have #[serde(remote = "...")]
--> $DIR/nonremote_getter.rs:12:10
|
12 | #[derive(Serialize)]
| ^^^^^^^^^
error: aborting due to previous error

View File

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

View File

@ -0,0 +1,16 @@
error[E0609]: no field `b` on type `&remote::S`
--> $DIR/unknown_field.rs:21:5
|
21 | b: u8,
| ^
error[E0560]: struct `remote::S` has no field named `b`
--> $DIR/unknown_field.rs:21:5
|
21 | b: u8,
| ^ field does not exist - did you mean `a`?
error: aborting due to 2 previous errors
Some errors occurred: E0560, E0609.
For more information about an error, try `rustc --explain E0560`.

View File

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

View File

@ -0,0 +1,13 @@
error[E0308]: mismatched types
--> $DIR/wrong_de.rs:16:10
|
16 | #[derive(Deserialize)]
| ^^^^^^^^^^^ expected u16, found u8
help: you can cast an `u8` to `u16`, which will zero-extend the source value
|
16 | #[derive(Deserialize.into())]
| ^^^^^^^^^^^^^^^^^^
error: aborting due to previous error
For more information about this error, try `rustc --explain E0308`.

View File

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

View File

@ -0,0 +1,12 @@
error[E0308]: mismatched types
--> $DIR/wrong_getter.rs:24:10
|
24 | #[derive(Serialize)]
| ^^^^^^^^^ expected u8, found u16
|
= note: expected type `&u8`
found type `&u16`
error: aborting due to previous error
For more information about this error, try `rustc --explain E0308`.

View File

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

View File

@ -0,0 +1,12 @@
error[E0308]: mismatched types
--> $DIR/wrong_ser.rs:18:10
|
18 | #[derive(Serialize)]
| ^^^^^^^^^ expected u8, found u16
|
= note: expected type `&u8`
found type `&u16`
error: aborting due to previous error
For more information about this error, try `rustc --explain E0308`.

View File

@ -11,7 +11,6 @@ extern crate serde_derive;
#[derive(Serialize)]
#[serde(transparent)]
//~^^ ERROR: #[serde(transparent)] requires struct to have at most one transparent field
struct S {
a: u8,
b: u8,

View File

@ -0,0 +1,8 @@
error: #[serde(transparent)] requires struct to have at most one transparent field
--> $DIR/at_most_one.rs:12:10
|
12 | #[derive(Serialize)]
| ^^^^^^^^^
error: aborting due to previous error

View File

@ -11,7 +11,6 @@ extern crate serde_derive;
#[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

@ -0,0 +1,8 @@
error: #[serde(transparent)] requires at least one field that is neither skipped nor has a default
--> $DIR/de_at_least_one.rs:12:10
|
12 | #[derive(Deserialize)]
| ^^^^^^^^^^^
error: aborting due to previous error

View File

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

Some files were not shown because too many files have changed in this diff Show More