mirror of
https://github.com/pezkuwichain/serde.git
synced 2026-04-22 21:48:02 +00:00
Added ui tests, Limited serde(tag = "...") to structs with named field
Added ui test struct-representation/internally-tagged-unit
Added ui test struct-representation/internally-tagged-tuple
Limited the serde(tag = "...") to enums and structs with named field
This commit is contained in:
@@ -0,0 +1,11 @@
|
||||
#[macro_use]
|
||||
extern crate serde_derive;
|
||||
|
||||
#[derive(Serialize)]
|
||||
#[serde(tag = "type")]
|
||||
struct S (
|
||||
u8,
|
||||
u8
|
||||
);
|
||||
|
||||
fn main() {}
|
||||
@@ -0,0 +1,12 @@
|
||||
error: #[serde(tag = "...")] can only be used on enums and structs with named fields
|
||||
--> $DIR/internally-taged-tuple.rs:6:10
|
||||
|
|
||||
6 | struct S (
|
||||
| __________^
|
||||
7 | | u8,
|
||||
8 | | u8
|
||||
9 | | );
|
||||
| |_^
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
#[macro_use]
|
||||
extern crate serde_derive;
|
||||
|
||||
#[derive(Serialize)]
|
||||
#[serde(tag = "type")]
|
||||
struct U;
|
||||
|
||||
fn main() {}
|
||||
@@ -0,0 +1,8 @@
|
||||
error: #[serde(tag = "...")] can only be used on enums and structs with named fields
|
||||
--> $DIR/internally-tagged-unit.rs:4:10
|
||||
|
|
||||
4 | #[derive(Serialize)]
|
||||
| ^^^^^^^^^
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
Reference in New Issue
Block a user