Skip to content

Commit

Permalink
Fix ident_key macro
Browse files Browse the repository at this point in the history
Summary:
It was not functional, every key was called `name`.

X-link: facebookexperimental/allocative#15

Reviewed By: IanChilds

Differential Revision: D67859121

Pulled By: KapJI

fbshipit-source-id: 3742329562daccbd9af12e19a9391783f3a797ee
  • Loading branch information
cormacrelf authored and facebook-github-bot committed Jan 6, 2025
1 parent 2af08a1 commit d9a827a
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion allocative/allocative/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,12 @@ pub mod __macro_refs {
#[macro_export]
macro_rules! ident_key {
($name:ident) => {{
const KEY: $crate::Key = $crate::Key::new(stringify!(name));
const KEY: $crate::Key = $crate::Key::new(stringify!($name));
KEY
}};
}

#[test]
fn ident_key() {
assert_eq!(ident_key!(foo), Key::new("foo"));
}

0 comments on commit d9a827a

Please sign in to comment.