You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Linux what 4.15.0-139-generic #143-Ubuntu SMP Tue Mar 16 01:30:17 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux
Description
Trying to #[instrument] a function which takes a debug or display parameter causes a compilation error.
For example, this:
use tracing::instrument;#[instrument]fnfoo(display:()){println!("{:?}", display);}fnmain(){foo(());}
results in the following error:
error[E0277]: `fn(_) -> DisplayValue<_> {display::<_>}` doesn't implement `Debug`
--> src/main.rs:3:1
|
3 | #[instrument]
| ^^^^^^^^^^^^^ `fn(_) -> DisplayValue<_> {display::<_>}` cannot be formatted using `{:?}` because it doesn't implement `Debug`
|
::: /playground/.cargo/registry/src/github.com-1ecc6299db9ec823/tracing-core-0.1.17/src/field.rs:266:8
|
266 | T: fmt::Debug,
| ---------- required by this bound in `debug`
|
= help: the trait `Debug` is not implemented for `fn(_) -> DisplayValue<_> {display::<_>}`
= note: required because of the requirements on the impl of `Debug` for `&fn(_) -> DisplayValue<_> {display::<_>}`
= note: this error originates in an attribute macro (in Nightly builds, run with -Z macro-backtrace for more info)
The text was updated successfully, but these errors were encountered:
sersorrel
changed the title
#[instrument] breaks compilation of functions with argument named display
#[instrument] breaks compilation of functions with argument named debug or displayMar 23, 2021
Bug Report
Version
Platform
Description
Trying to
#[instrument]
a function which takes adebug
ordisplay
parameter causes a compilation error.For example, this:
results in the following error:
(playground link)
Possibly related: #805
The text was updated successfully, but these errors were encountered: