rust-lang-nursery / lazy-static.rs

A small macro for defining lazy evaluated static variables in Rust.
Apache License 2.0
1.9k stars 108 forks source link

error[E0195]: lifetime parameters or bounds on type `Target` #217

Open simbleau opened 4 months ago

simbleau commented 4 months ago

Not long ago, basically any crate that uses lazy_static just halted working for me. I even uninstalled rust and reinstalled it. I'm on M1 apple, Rust 1.76 stable. Not sure what's going on, does anyone have any clues?

Rust:

12:47 simbleau on bevy-0.13-dev ~ rustup show          
Default host: aarch64-apple-darwin
rustup home:  /Users/simbleau/.rustup

stable-aarch64-apple-darwin (default)
rustc 1.76.0 (07dca489a 2024-02-04)

Stack trace:


   Compiling tracing-log v0.1.4
   Compiling libloading v0.8.1
   Compiling accesskit v0.12.2
error[E0195]: lifetime parameters or bounds on type `Target` do not match the trait declaration
  --> /Users/simbleau/.cargo/registry/src/index.crates.io-6f17d22bba15001f/sharded-slab-0.1.7/src/tid.rs:32:1
   |
32 | / lazy_static! {
33 | |     static ref REGISTRY: Registry = Registry {
34 | |         next: AtomicUsize::new(0),
35 | |         free: Mutex::new(VecDeque::new()),
36 | |     };
37 | | }
   | |_^ 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)

   Compiling parking_lot_core v0.9.9
   Compiling wgpu-types v0.19.2
   Compiling metal v0.27.0
error[E0609]: no field `free` on type `REGISTRY`
   --> /Users/simbleau/.cargo/registry/src/index.crates.io-6f17d22bba15001f/sharded-slab-0.1.7/src/tid.rs:150:14
    |
150 |             .free
    |              ^^^^ unknown field
    |
    = note: available field is: `__private_field`

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

error[E0609]: no field `free` on type `REGISTRY`
   --> /Users/simbleau/.cargo/registry/src/index.crates.io-6f17d22bba15001f/sharded-slab-0.1.7/src/tid.rs:191:42
    |
191 |             let mut free_list = REGISTRY.free.lock().unwrap_or_else(PoisonError::into_inner);
    |                                          ^^^^ unknown field
    |
    = note: available field is: `__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
warning: build failed, waiting for other jobs to finish...
Toni-Graphics commented 1 month ago

I get the same error, how did you fixed it?

simbleau commented 1 month ago

I think I just moved over to once_cell instead of lazy_static.

This crate is basically abandoned

Toni-Graphics commented 1 month ago

Thanks