`tracing-subscriber` suddenly broke

Problem

Everything worked fine in my repo. Then all of a sudden (today), running cargo r started throwing errors. I narrowed down the source of the problem to tracing-subscriber dependency (in blank new repository), and from there I narrowed it down to issues in sharded-slab crate (which is a dependency of tracing-subscriber.

Here's what I tried to fix it:

  • compiler versions 1.78 & 1.75 & 1.70
  • tracing-subscriber versions 0.3.18, 0.3.0, 0.2.0
  • downgrading sharded-slab from 0.1.7 to 0.1.6

none of the above worked.

Here is the error messsage:

error[E0195]: lifetime parameters or bounds on type `Target` do not match the trait declaration
  --> /home/x/.cargo/registry/src/index.crates.io-6f17d22bba15001f/sharded-slab-0.1.6/src/tid.rs:33:1
   |
33 | / lazy_static! {
34 | |     static ref REGISTRY: Registry = Registry {
35 | |         next: AtomicUsize::new(0),
36 | |         free: Mutex::new(VecDeque::new()),
37 | |     };
38 | | }
   | |_^ lifetimes do not match type in trait
   |
   = note: this error originates in the macro `__lazy_static_internal` which comes from the expansion of the macro `lazy_static` (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0609]: no field `free` on type `REGISTRY`
   --> /home/x/.cargo/registry/src/index.crates.io-6f17d22bba15001f/sharded-slab-0.1.6/src/tid.rs:151:14
    |
151 |             .free
    |              ^^^^ unknown field
    |
    = note: available fields are: `__private_field`

error[E0609]: no field `next` on type `REGISTRY`
   --> /home/x/.cargo/registry/src/index.crates.io-6f17d22bba15001f/sharded-slab-0.1.6/src/tid.rs:162:35
    |
162 |                 let id = REGISTRY.next.fetch_add(1, Ordering::AcqRel);
    |                                   ^^^^ unknown field
    |
    = note: available fields are: `__private_field`

error[E0609]: no field `free` on type `REGISTRY`
   --> /home/x/.cargo/registry/src/index.crates.io-6f17d22bba15001f/sharded-slab-0.1.6/src/tid.rs:190:42
    |
190 |             let mut free_list = REGISTRY.free.lock().unwrap_or_else(PoisonError::into_inner);
    |                                          ^^^^ unknown field
    |
    = note: available fields are: `__private_field`

Some errors have detailed explanations: E0195, E0609.
For more information about an error, try `rustc --explain E0195`.
error: could not compile `sharded-slab` (lib) due to 4 previous errors

I solved it by reinstalling the compiler

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.