Skip to content

Commit

Permalink
tracing: attempt to monomorphization is_enabled call
Browse files Browse the repository at this point in the history
  • Loading branch information
davidbarsky committed Jul 7, 2020
1 parent e58a869 commit 445b41f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
7 changes: 7 additions & 0 deletions tracing/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -869,6 +869,13 @@ pub mod __macro_support {
pub type Once = tracing_core::Once;
}

#[doc(hidden)]
// resolves https://github.com/tokio-rs/tracing/issues/783 by forcing a monomorphization
// in tracing, not downstream crates.
pub fn is_enabled(meta: &crate::Metadata<'_>) -> bool {
crate::dispatcher::get_default(|current| current.enabled(meta))
}

mod sealed {
pub trait Sealed {}
}
2 changes: 1 addition & 1 deletion tracing/src/macros.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1860,7 +1860,7 @@ macro_rules! is_enabled {
true
} else {
let meta = $callsite.metadata();
$crate::dispatcher::get_default(|current| current.enabled(meta))
$crate::is_enabled(meta)
}
}};
}
Expand Down

0 comments on commit 445b41f

Please sign in to comment.