mirror of
https://github.com/pezkuwichain/serde.git
synced 2026-06-15 15:31:01 +00:00
Fixed a compilefail test for flatten on enums
This commit is contained in:
@@ -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 {
|
||||||
|
|||||||
Reference in New Issue
Block a user