c3ac7b675a
Currently panics in derive: error: proc-macro derive panicked --> test_suite\tests\test_annotations.rs:2386:25 | 2386 | #[derive(Serialize, Deserialize, PartialEq, Debug)] | ^^^^^^^^^^^ | = help: message: assertion failed: !cattrs.has_flatten() error: proc-macro derive panicked --> test_suite\tests\regression\issue1904.rs:57:10 | 57 | #[derive(Deserialize)] | ^^^^^^^^^^^ | = help: message: assertion failed: !cattrs.has_flatten() error: proc-macro derive panicked --> test_suite\tests\regression\issue1904.rs:47:10 | 47 | #[derive(Deserialize)] | ^^^^^^^^^^^ | = help: message: assertion failed: !cattrs.has_flatten() error: proc-macro derive panicked --> test_suite\tests\regression\issue1904.rs:37:10 | 37 | #[derive(Deserialize)] | ^^^^^^^^^^^ | = help: message: assertion failed: !cattrs.has_flatten() error: proc-macro derive panicked --> test_suite\tests\regression\issue1904.rs:27:10 | 27 | #[derive(Deserialize)] | ^^^^^^^^^^^ | = help: message: assertion failed: !cattrs.has_flatten() error: proc-macro derive panicked --> test_suite\tests\regression\issue1904.rs:16:10 | 16 | #[derive(Deserialize)] | ^^^^^^^^^^^ | = help: message: assertion failed: !cattrs.has_flatten() error: proc-macro derive panicked --> test_suite\tests\regression\issue1904.rs:7:10 | 7 | #[derive(Deserialize)] | ^^^^^^^^^^^ | = help: message: assertion failed: !cattrs.has_flatten()
66 lines
1.2 KiB
Rust
66 lines
1.2 KiB
Rust
#![allow(dead_code)] // we do not read enum fields
|
|
use serde_derive::Deserialize;
|
|
|
|
#[derive(Deserialize)]
|
|
pub struct Nested;
|
|
|
|
#[derive(Deserialize)]
|
|
pub enum ExternallyTagged1 {
|
|
Tuple(f64, String),
|
|
Flatten {
|
|
#[serde(flatten)]
|
|
nested: Nested,
|
|
},
|
|
}
|
|
|
|
#[derive(Deserialize)]
|
|
pub enum ExternallyTagged2 {
|
|
Flatten {
|
|
#[serde(flatten)]
|
|
nested: Nested,
|
|
},
|
|
Tuple(f64, String),
|
|
}
|
|
|
|
// Internally tagged enums cannot contain tuple variants so not tested here
|
|
|
|
#[derive(Deserialize)]
|
|
#[serde(tag = "tag", content = "content")]
|
|
pub enum AdjacentlyTagged1 {
|
|
Tuple(f64, String),
|
|
Flatten {
|
|
#[serde(flatten)]
|
|
nested: Nested,
|
|
},
|
|
}
|
|
|
|
#[derive(Deserialize)]
|
|
#[serde(tag = "tag", content = "content")]
|
|
pub enum AdjacentlyTagged2 {
|
|
Flatten {
|
|
#[serde(flatten)]
|
|
nested: Nested,
|
|
},
|
|
Tuple(f64, String),
|
|
}
|
|
|
|
#[derive(Deserialize)]
|
|
#[serde(untagged)]
|
|
pub enum Untagged1 {
|
|
Tuple(f64, String),
|
|
Flatten {
|
|
#[serde(flatten)]
|
|
nested: Nested,
|
|
},
|
|
}
|
|
|
|
#[derive(Deserialize)]
|
|
#[serde(untagged)]
|
|
pub enum Untagged2 {
|
|
Flatten {
|
|
#[serde(flatten)]
|
|
nested: Nested,
|
|
},
|
|
Tuple(f64, String),
|
|
}
|