From 28a0c385acf97541c84d1035e026b059cbf494a1 Mon Sep 17 00:00:00 2001 From: Ryo Onodera Date: Wed, 11 Jan 2023 16:15:06 +0900 Subject: [PATCH] Support frozen abi for Cow with workaround --- frozen-abi/src/abi_example.rs | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/frozen-abi/src/abi_example.rs b/frozen-abi/src/abi_example.rs index ffcc4676ebf63d..37faaba946b750 100644 --- a/frozen-abi/src/abi_example.rs +++ b/frozen-abi/src/abi_example.rs @@ -390,11 +390,12 @@ impl AbiExample for BTreeMap } } -// impl<'a, T: AbiExample> AbiExample for std::borrow::Cow<'a, T> { -// fn example() -> Self { -// Self::Owned(T::example()) -// } -// } +// + Clone is needed to work around this rustc bug: https://github.com/rust-lang/rust/issues/106710 +impl AbiExample for std::borrow::Cow<'_, T> { + fn example() -> Self { + Self::Owned(T::example()) + } +} impl AbiExample for Vec { fn example() -> Self {