Skip to content

Fix macro hygiene for concat! calls #1842

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

Merged
merged 2 commits into from
Jan 28, 2022
Merged
Show file tree
Hide file tree
Changes from all 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
1 change: 1 addition & 0 deletions tracing/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -936,6 +936,7 @@ pub mod __macro_support {
sync::atomic::{AtomicUsize, Ordering},
};
use crate::{subscriber::Interest, Metadata};
pub use core::concat;
use tracing_core::Once;

/// Callsite implementation used by macro-generated code.
Expand Down
6 changes: 3 additions & 3 deletions tracing/src/macros.rs
Original file line number Diff line number Diff line change
Expand Up @@ -592,7 +592,7 @@ macro_rules! event {
if $crate::level_enabled!($lvl) {
use $crate::__macro_support::*;
static CALLSITE: $crate::__macro_support::MacroCallsite = $crate::callsite2! {
name: concat!(
name: $crate::__macro_support::concat!(
"event ",
file!(),
":",
Expand Down Expand Up @@ -639,7 +639,7 @@ macro_rules! event {
if $crate::level_enabled!($lvl) {
use $crate::__macro_support::*;
static CALLSITE: $crate::__macro_support::MacroCallsite = $crate::callsite2! {
name: concat!(
name: $crate::__macro_support::concat!(
"event ",
file!(),
":",
Expand Down Expand Up @@ -2171,7 +2171,7 @@ macro_rules! __tracing_log {
macro_rules! __mk_format_string {
// === base case ===
(@ { $(,)* $($out:expr),* $(,)* } $(,)*) => {
concat!( $($out),*)
$crate::__macro_support::concat!( $($out),*)
};

// === recursive case (more tts), ===
Expand Down