Added flatten on enum compile fail test
This commit is contained in:
parent
bb2ecb3bc4
commit
99614c7266
@ -46,7 +46,7 @@ fn check_flatten(cx: &Ctxt, cont: &Container) {
|
||||
match cont.data {
|
||||
Data::Enum(_) => {
|
||||
if cont.attrs.has_flatten() {
|
||||
cx.error("#[serde(flatten)] is not allowed in an enum");
|
||||
cx.error("#[serde(flatten)] is not supported on enums");
|
||||
}
|
||||
}
|
||||
Data::Struct(_, _) => {
|
||||
|
@ -0,0 +1,21 @@
|
||||
// Copyright 2018 Serde Developers
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
||||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
#[macro_use]
|
||||
extern crate serde_derive;
|
||||
|
||||
#[derive(Serialize)] //~ ERROR: proc-macro derive panicked
|
||||
//~^ HELP: #[serde(flatten] is not supported on enums
|
||||
enum Foo {
|
||||
#[serde(flatten)]
|
||||
Foo {
|
||||
x: u32,
|
||||
}
|
||||
}
|
||||
|
||||
fn main() {}
|
Loading…
x
Reference in New Issue
Block a user