Skip to content
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

tracing-subscriber 0.3.12 fails to compile with env-filter feature #2189

Closed
msfjarvis opened this issue Jun 30, 2022 · 1 comment
Closed

Comments

@msfjarvis
Copy link

Bug Report

Version

  • tracing: v0.1.35
  • tracing-subscriber: v0.3.12 with features = [ "env-filter" ]

Platform

Linux ryzenbox 5.15.0-33-generic #34~20.04.1-Ubuntu SMP Thu May 19 15:51:16 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux

Crates

tracing-subscriber

Description

Upgrading tracing-subscriber from 0.3.11 to 0.3.12 causes it to fail to compile. The error messages don't point to my own code but I'm enclosing it with the error anyway.

Here's the project where it's failing: msfjarvis/clipboard-substitutor#18

tracing-specific code from the project
#[cfg(not(feature = "journald"))]
fn configure_tracing() {
  use tracing::Level;
  use tracing_subscriber::FmtSubscriber;

  let subscriber = FmtSubscriber::builder()
    .with_max_level(Level::TRACE)
    .finish();

  tracing::subscriber::set_global_default(subscriber)
    .expect("setting default subscriber failed");
}

#[cfg(feature = "journald")]
fn configure_tracing() {
  use tracing_journald::Layer;
  use tracing_subscriber::layer::SubscriberExt;
  use tracing_subscriber::Registry;

  let subscriber =
    Registry::default().with(Layer::new().unwrap().with_field_prefix(None));
  tracing::subscriber::set_global_default(subscriber)
    .expect("setting default subscriber failed");
}
Errors
error[E0407]: method `event_enabled` is not a member of trait `Subscriber`
   --> /home/msfjarvis/.cargo/registry/src/github.com-1ecc6299db9ec823/tracing-subscriber-0.3.12/src/layer/layered.rs:142:5
    |
142 | /     fn event_enabled(&self, event: &Event<'_>) -> bool {
143 | |         if self.layer.event_enabled(event, self.ctx()) {
144 | |             // if the outer layer enables the event, ask the inner subscriber.
145 | |             self.inner.event_enabled(event)
...   |
149 | |         }
150 | |     }
    | |_____^ not a member of trait `Subscriber`

error[E0407]: method `event_enabled` is not a member of trait `tracing_core::Subscriber`
   --> /home/msfjarvis/.cargo/registry/src/github.com-1ecc6299db9ec823/tracing-subscriber-0.3.12/src/fmt/mod.rs:401:5
    |
401 | /     fn event_enabled(&self, event: &Event<'_>) -> bool {
402 | |         self.inner.event_enabled(event)
403 | |     }
    | |_____^ not a member of trait `tracing_core::Subscriber`

error[E0599]: no method named `event_enabled` found for type parameter `S` in the current scope
   --> /home/msfjarvis/.cargo/registry/src/github.com-1ecc6299db9ec823/tracing-subscriber-0.3.12/src/layer/layered.rs:145:24
    |
145 |             self.inner.event_enabled(event)
    |                        ^^^^^^^^^^^^^ method not found in `S`
    |
    = help: items from traits can only be used if the type parameter is bounded by the trait
help: the following trait defines an item `event_enabled`, perhaps you need to restrict type parameter `S` with it:
    |
94  | impl<L, S: layer::Layer> Subscriber for Layered<L, S>
    |         ~~~~~~~~~~~~~~~

error[E0599]: the method `event_enabled` exists for struct `layered::Layered<F, layered::Layered<fmt_layer::Layer<Registry, N, E, W>, Registry>>`, but its trait bounds were not satisfied
    --> /home/msfjarvis/.cargo/registry/src/github.com-1ecc6299db9ec823/tracing-subscriber-0.3.12/src/fmt/mod.rs:402:20
     |
402  |         self.inner.event_enabled(event)
     |                    ^^^^^^^^^^^^^ method cannot be called on `layered::Layered<F, layered::Layered<fmt_layer::Layer<Registry, N, E, W>, Registry>>` due to unsatisfied trait bounds
     |
    ::: /home/msfjarvis/.cargo/registry/src/github.com-1ecc6299db9ec823/tracing-subscriber-0.3.12/src/layer/layered.rs:27:1
     |
27   | pub struct Layered<L, I, S = I> {
     | -------------------------------
     | |
     | method `event_enabled` not found for this
     | doesn't satisfy `_: layer::Layer<layered::Layered<fmt_layer::Layer<Registry, N, E, W>, Registry>>`
     |
note: trait bound `layered::Layered<fmt_layer::Layer<Registry, N, E, W>, Registry>: layer::Layer<layered::Layered<fmt_layer::Layer<Registry, N, E, W>, Registry>>` was not satisfied
    --> /home/msfjarvis/.cargo/registry/src/github.com-1ecc6299db9ec823/tracing-subscriber-0.3.12/src/layer/layered.rs:245:8
     |
242  | impl<S, A, B> Layer<S> for Layered<A, B, S>
     |               --------     ----------------
...
245  |     B: Layer<S>,
     |        ^^^^^^^^ unsatisfied trait bound introduced here
note: the following trait must be implemented
    --> /home/msfjarvis/.cargo/registry/src/github.com-1ecc6299db9ec823/tracing-subscriber-0.3.12/src/layer/mod.rs:709:1
     |
709  | / pub trait Layer<S>
710  | | where
711  | |     S: Subscriber,
712  | |     Self: 'static,
...    |
1207 | |     }
1208 | | }
     | |_^
     = help: items from traits can only be used if the trait is implemented and in scope
note: `layer::Layer` defines an item `event_enabled`, perhaps you need to implement it
    --> /home/msfjarvis/.cargo/registry/src/github.com-1ecc6299db9ec823/tracing-subscriber-0.3.12/src/layer/mod.rs:709:1
     |
709  | / pub trait Layer<S>
710  | | where
711  | |     S: Subscriber,
712  | |     Self: 'static,
...    |
1207 | |     }
1208 | | }
     | |_^

Some errors have detailed explanations: E0407, E0599.
For more information about an error, try `rustc --explain E0407`.
error: could not compile `tracing-subscriber` due to 4 previous errors
warning: build failed, waiting for other jobs to finish...

Looks like it is related to #2008?

@hawkw
Copy link
Member

hawkw commented Jul 1, 2022

Thanks, sorry I missed this issue yesterday, but today's tracing-subscriber 0.3.14 release should fix this issue, and the effected versions have been yanked. Sorry about that!

@hawkw hawkw closed this as completed Jul 1, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants