From c69d6ed6c77b38dd1756d1c5819011b6e3ebda4d Mon Sep 17 00:00:00 2001 From: Philip Degarmo Date: Sun, 13 Oct 2024 19:53:22 -0700 Subject: [PATCH] Add the static and literal bounds to scope names. This is required by tracing, and several other backends require &'static strings --- profiling/examples/simple.rs | 5 +---- profiling/src/type_check_impl.rs | 4 ++-- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/profiling/examples/simple.rs b/profiling/examples/simple.rs index 75715af..a88b7e7 100644 --- a/profiling/examples/simple.rs +++ b/profiling/examples/simple.rs @@ -50,10 +50,7 @@ fn some_other_function(iterations: usize) { burn_time(5); { - // Make this a non-literal to touch more of the API. It still has to be 'static scope though - // for multiple of the backends - let scope_name = "do_iterations"; - profiling::scope!(scope_name); + profiling::scope!("do_iterations"); for i in 0..iterations { profiling::scope!( "some_inner_function_that_sleeps", diff --git a/profiling/src/type_check_impl.rs b/profiling/src/type_check_impl.rs index fb3368e..7c01259 100644 --- a/profiling/src/type_check_impl.rs +++ b/profiling/src/type_check_impl.rs @@ -2,10 +2,10 @@ #[macro_export] macro_rules! scope { - ($name:expr) => { + ($name:literal) => { let _: &str = $name; }; - ($name:expr, $data:expr) => { + ($name:literal, $data:expr) => { let _: &str = $name; let _: &str = $data; };