diff --git a/libafl_bolts/src/serdeany.rs b/libafl_bolts/src/serdeany.rs index 5d292e5286..b70ebc6336 100644 --- a/libafl_bolts/src/serdeany.rs +++ b/libafl_bolts/src/serdeany.rs @@ -1,8 +1,8 @@ //! Poor-rust-man's downcasts for stuff we send over the wire (or shared maps) -use alloc::boxed::Box; #[cfg(feature = "stable_anymap")] -use alloc::string::{String, ToString}; +use alloc::borrow::Cow; +use alloc::boxed::Box; #[cfg(feature = "stable_anymap")] use core::any::type_name; #[cfg(not(feature = "stable_anymap"))] @@ -21,7 +21,7 @@ pub type TypeRepr = u128; /// The type of a stored type in this anymap (`String`) #[cfg(feature = "stable_anymap")] -pub type TypeRepr = String; +pub type TypeRepr = Cow<'static, str>; #[cfg(not(feature = "stable_anymap"))] fn type_repr() -> TypeRepr @@ -41,7 +41,7 @@ where #[cfg(feature = "stable_anymap")] fn type_repr_owned() -> TypeRepr { - type_name::().to_string() + Cow::Borrowed(type_name::()) } #[cfg(feature = "stable_anymap")]