Bug Report
Version
v0.1.41
Platform
Linux <redacted> 6.6.87.2-microsoft-standard-WSL2 #1 SMP PREEMPT_DYNAMIC Thu Jun 5 18:30:46 UTC 2025 x86_64 x86_64 x86_64 GNU/Linux
Description
There seems to be a sanitation bug in tracing macros, which produces a compile error if you use debug as one of argument names for string interpolation:
fn main() {
let debug = false;
tracing::trace!("debug: {debug:?}");
tracing::debug!("debug: {debug:?}");
tracing::warn!("debug: {debug:?}");
tracing::info!("debug: {debug:?}");
tracing::error!("debug: {debug:?}");
}
This should compile without errors, but we get:
error[E0277]: `fn(_) -> DebugValue<_> {debug::<_>}` doesn't implement `Debug`
--> tracing_bug/src/main.rs:3:30
|
3 | tracing::trace!("debug: {debug:?}");
| -^^^^^---
| ||
| |`fn(_) -> DebugValue<_> {debug::<_>}` cannot be formatted using `{:?}` because it doesn't implement `Debug`
| required by this formatting parameter
|
(Error help and other similar error messages omitted for brevity).
Notes:
- The issue does not happen if the argument ident is
trace, warn, info, or error.
let trace = false;
tracing::trace!("debug: {trace:?}"); // compiles
let warn = false;
tracing::trace!("debug: {warn:?}"); // compiles
let info = false;
tracing::trace!("debug: {info:?}"); // compiles
let error = false;
tracing::trace!("debug: {error:?}"); // compiles
- Other macros may be affected, but I have not exhaustively tested it.