#![allow( clippy::extra_unused_type_parameters, clippy::type_repetition_in_bounds )] #[test] fn test_gen_custom_serde() { #[derive(serde_derive::Serialize, serde_derive::Deserialize)] #[serde(crate = "fake_serde")] struct Foo; // Would be overlapping if serde::Serialize were implemented impl AssertNotSerdeSerialize for Foo {} // Would be overlapping if serde::Deserialize were implemented impl<'a> AssertNotSerdeDeserialize<'a> for Foo {} fake_serde::assert::(); } mod fake_serde { pub use serde::*; pub fn assert() where T: Serialize, T: for<'a> Deserialize<'a>, { } pub trait Serialize { fn serialize(&self, serializer: S) -> Result; } pub trait Deserialize<'a>: Sized { fn deserialize>(deserializer: D) -> Result; } } trait AssertNotSerdeSerialize {} impl AssertNotSerdeSerialize for T {} trait AssertNotSerdeDeserialize<'a> {} impl<'a, T: serde::Deserialize<'a>> AssertNotSerdeDeserialize<'a> for T {}