Special case for 'static fields

This commit is contained in:
David Tolnay
2017-09-09 11:34:08 -07:00
parent c3eced410f
commit 0085d05e55
3 changed files with 112 additions and 48 deletions
+24
View File
@@ -10,6 +10,8 @@
// successfully when there are a variety of generics and non-(de)serializable
// types involved.
#![deny(warnings)]
#![cfg_attr(feature = "unstable", feature(non_ascii_idents))]
// Clippy false positive
@@ -491,6 +493,28 @@ fn test_gen() {
Unit,
}
assert_ser::<UntaggedVariantWith>();
#[derive(Serialize, Deserialize)]
struct StaticStrStruct<'a> {
a: &'a str,
b: &'static str,
}
#[derive(Serialize, Deserialize)]
struct StaticStrTupleStruct<'a>(&'a str, &'static str);
#[derive(Serialize, Deserialize)]
struct StaticStrNewtypeStruct(&'static str);
#[derive(Serialize, Deserialize)]
enum StaticStrEnum<'a> {
Struct {
a: &'a str,
b: &'static str,
},
Tuple(&'a str, &'static str),
Newtype(&'static str),
}
}
//////////////////////////////////////////////////////////////////////////