Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wrap metadata elements in Cow #2364

Merged
merged 6 commits into from
Jul 7, 2024
Merged
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions libafl_bolts/src/serdeany.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

use alloc::boxed::Box;
#[cfg(feature = "stable_anymap")]
use alloc::string::{String, ToString};
use alloc::{borrow::Cow, string::ToString};
#[cfg(feature = "stable_anymap")]
use core::any::type_name;
#[cfg(not(feature = "stable_anymap"))]
Expand All @@ -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<T>() -> TypeRepr
Expand All @@ -41,7 +41,7 @@ where

#[cfg(feature = "stable_anymap")]
fn type_repr_owned<T>() -> TypeRepr {
type_name::<T>().to_string()
TypeRepr::from(type_name::<T>().to_string())
Nereuxofficial marked this conversation as resolved.
Show resolved Hide resolved
}

#[cfg(feature = "stable_anymap")]
Expand Down
Loading