Fix generation of non-existent lifetime 'de when enum contains a #[serde(flatten)] field and a 'static reference
This commit is contained in:
parent
a13c6382b6
commit
c7393614ff
@ -1006,7 +1006,7 @@ fn deserialize_struct(
|
||||
|
||||
fn deserialize<__D>(self, __deserializer: __D) -> _serde::__private::Result<Self::Value, __D::Error>
|
||||
where
|
||||
__D: _serde::Deserializer<'de>,
|
||||
__D: _serde::Deserializer<#delife>,
|
||||
{
|
||||
_serde::Deserializer::deserialize_map(__deserializer, self)
|
||||
}
|
||||
|
@ -892,3 +892,53 @@ pub struct RemotePackedNonCopyDef {
|
||||
impl Drop for RemotePackedNonCopyDef {
|
||||
fn drop(&mut self) {}
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/// Regression tests for <https://github.com/serde-rs/serde/issues/2371>
|
||||
#[allow(dead_code)]
|
||||
mod static_and_flatten {
|
||||
use super::*;
|
||||
|
||||
#[derive(Deserialize)]
|
||||
struct Nested;
|
||||
|
||||
#[derive(Deserialize)]
|
||||
enum ExternallyTagged {
|
||||
Flatten {
|
||||
#[serde(flatten)]
|
||||
nested: Nested,
|
||||
string: &'static str,
|
||||
},
|
||||
}
|
||||
|
||||
#[derive(Deserialize)]
|
||||
#[serde(tag = "tag")]
|
||||
enum InternallyTagged {
|
||||
Flatten {
|
||||
#[serde(flatten)]
|
||||
nested: Nested,
|
||||
string: &'static str,
|
||||
},
|
||||
}
|
||||
|
||||
#[derive(Deserialize)]
|
||||
#[serde(tag = "tag", content = "content")]
|
||||
enum AdjacentlyTagged {
|
||||
Flatten {
|
||||
#[serde(flatten)]
|
||||
nested: Nested,
|
||||
string: &'static str,
|
||||
},
|
||||
}
|
||||
|
||||
#[derive(Deserialize)]
|
||||
#[serde(untagged)]
|
||||
enum UntaggedWorkaround {
|
||||
Flatten {
|
||||
#[serde(flatten)]
|
||||
nested: Nested,
|
||||
string: &'static str,
|
||||
},
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user