tokio-rs / tracing

Application level tracing for Rust.
https://tracing.rs
MIT License
5.39k stars 707 forks source link

`Name / parent` form of `event!()` macro doesn't compile #2984

Open Mododo opened 4 months ago

Mododo commented 4 months ago

Bug Report

Version

tracing 0.1.40

Platform

Fedora Linux 40, all affected

Crates

tracing

Description

I'm unable to use this form of event!() macro:

let span = tracing::info_span!("parent");
tracing::event!(name: "name", parent: &span, tracing::Level::ERROR, "foo");

and its variants (debug!(), etc) due to error

error[E0599]: no method named `is_enabled` found for struct `DefaultCallsite` in the current scope
    |
    |         tracing::event!(name: "name", parent: &span, tracing::Level::ERROR, "foo");
    |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ method not found in `DefaultCallsite`
    |
    = note: this error originates in the macro `$crate::event` which comes from the expansion of the macro `tracing::event` (in Nightly builds, run with -Z macro-backtrace for more info)

error: could not compile ...

Looks like it was missed out by accident. Pull request with fix: https://github.com/tokio-rs/tracing/pull/2983