Fixed a compilefail test for flatten on enums

This commit is contained in:
Armin Ronacher 2018-03-20 23:26:22 +01:00
parent 0fde3c2ee8
commit 3d647f4063
2 changed files with 2 additions and 4 deletions

View File

@ -45,9 +45,7 @@ fn check_getter(cx: &Ctxt, cont: &Container) {
fn check_flatten(cx: &Ctxt, cont: &Container) {
match cont.data {
Data::Enum(_) => {
if cont.attrs.has_flatten() {
cx.error("#[serde(flatten)] is not supported on enums");
}
debug_assert!(!cont.attrs.has_flatten());
}
Data::Struct(_, _) => {
for field in cont.data.all_fields() {

View File

@ -10,7 +10,7 @@
extern crate serde_derive;
#[derive(Serialize)] //~ ERROR: proc-macro derive panicked
//~^ HELP: #[serde(flatten] is not supported on enums
//~^ HELP: unknown serde variant attribute `flatten`
enum Foo {
#[serde(flatten)]
Foo {