diff --git a/tracing/src/macros.rs b/tracing/src/macros.rs index ec680f43ba..7bf2ec18a3 100644 --- a/tracing/src/macros.rs +++ b/tracing/src/macros.rs @@ -585,7 +585,7 @@ macro_rules! event { (target: $target:expr, parent: $parent:expr, $lvl:expr, { $($fields:tt)* } )=> ({ use $crate::__macro_support::Callsite as _; static CALLSITE: $crate::__macro_support::MacroCallsite = $crate::callsite2! { - name: concat!( + name: $crate::__macro_support::concat!( "event ", file!(), ":", @@ -642,7 +642,7 @@ macro_rules! event { (target: $target:expr, $lvl:expr, { $($fields:tt)* } )=> ({ use $crate::__macro_support::Callsite as _; static CALLSITE: $crate::__macro_support::MacroCallsite = $crate::callsite2! { - name: concat!( + name: $crate::__macro_support::concat!( "event ", file!(), ":", @@ -890,7 +890,7 @@ macro_rules! enabled { if $crate::level_enabled!($lvl) { use $crate::__macro_support::Callsite as _; static CALLSITE: $crate::__macro_support::MacroCallsite = $crate::callsite2! { - name: concat!( + name: $crate::__macro_support::concat!( "enabled ", file!(), ":", diff --git a/tracing/tests/macros_incompatible_concat.rs b/tracing/tests/macros_incompatible_concat.rs new file mode 100644 index 0000000000..bda6b964fa --- /dev/null +++ b/tracing/tests/macros_incompatible_concat.rs @@ -0,0 +1,24 @@ +use tracing::{enabled, event, span, Level}; + +#[macro_export] +macro_rules! concat { + () => {}; +} + +#[cfg_attr(target_arch = "wasm32", wasm_bindgen_test::wasm_bindgen_test)] +#[test] +fn span() { + span!(Level::DEBUG, "foo"); +} + +#[cfg_attr(target_arch = "wasm32", wasm_bindgen_test::wasm_bindgen_test)] +#[test] +fn event() { + event!(Level::DEBUG, "foo"); +} + +#[cfg_attr(target_arch = "wasm32", wasm_bindgen_test::wasm_bindgen_test)] +#[test] +fn enabled() { + enabled!(Level::DEBUG); +} diff --git a/tracing/tests/macros_redefined_core.rs b/tracing/tests/macros_redefined_core.rs new file mode 100644 index 0000000000..5932c06553 --- /dev/null +++ b/tracing/tests/macros_redefined_core.rs @@ -0,0 +1,21 @@ +extern crate self as core; + +use tracing::{enabled, event, span, Level}; + +#[cfg_attr(target_arch = "wasm32", wasm_bindgen_test::wasm_bindgen_test)] +#[test] +fn span() { + span!(Level::DEBUG, "foo"); +} + +#[cfg_attr(target_arch = "wasm32", wasm_bindgen_test::wasm_bindgen_test)] +#[test] +fn event() { + event!(Level::DEBUG, "foo"); +} + +#[cfg_attr(target_arch = "wasm32", wasm_bindgen_test::wasm_bindgen_test)] +#[test] +fn enabled() { + enabled!(Level::DEBUG); +}