mirror of
https://github.com/serde-rs/serde.git
synced 2025-10-01 15:01:49 +00:00
Fixed a compilefail test for flatten on enums
This commit is contained in:
parent
0fde3c2ee8
commit
3d647f4063
@ -45,9 +45,7 @@ fn check_getter(cx: &Ctxt, cont: &Container) {
|
|||||||
fn check_flatten(cx: &Ctxt, cont: &Container) {
|
fn check_flatten(cx: &Ctxt, cont: &Container) {
|
||||||
match cont.data {
|
match cont.data {
|
||||||
Data::Enum(_) => {
|
Data::Enum(_) => {
|
||||||
if cont.attrs.has_flatten() {
|
debug_assert!(!cont.attrs.has_flatten());
|
||||||
cx.error("#[serde(flatten)] is not supported on enums");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
Data::Struct(_, _) => {
|
Data::Struct(_, _) => {
|
||||||
for field in cont.data.all_fields() {
|
for field in cont.data.all_fields() {
|
||||||
|
@ -10,7 +10,7 @@
|
|||||||
extern crate serde_derive;
|
extern crate serde_derive;
|
||||||
|
|
||||||
#[derive(Serialize)] //~ ERROR: proc-macro derive panicked
|
#[derive(Serialize)] //~ ERROR: proc-macro derive panicked
|
||||||
//~^ HELP: #[serde(flatten] is not supported on enums
|
//~^ HELP: unknown serde variant attribute `flatten`
|
||||||
enum Foo {
|
enum Foo {
|
||||||
#[serde(flatten)]
|
#[serde(flatten)]
|
||||||
Foo {
|
Foo {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user