Inherit the visibility of remote struct definition

This commit is contained in:
David Tolnay
2017-07-25 23:52:06 -07:00
parent e6487cf6fa
commit f36a1e0895
3 changed files with 19 additions and 2 deletions
+15
View File
@@ -358,6 +358,21 @@ fn test_gen() {
#[serde(borrow, with = "StrDef")]
s: Str<'a>,
}
mod vis {
pub struct S;
#[derive(Serialize, Deserialize)]
#[serde(remote = "S")]
pub struct SDef;
}
// This would not work if SDef::serialize / deserialize are private.
#[derive(Serialize, Deserialize)]
struct RemoteVisibility {
#[serde(with = "vis::SDef")]
s: vis::S,
}
}
//////////////////////////////////////////////////////////////////////////