lazy-static.rs icon indicating copy to clipboard operation
lazy-static.rs copied to clipboard

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

Open simbleau opened this issue 1 year ago • 3 comments

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...

simbleau avatar Mar 10 '24 16:03 simbleau

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

Cr0a3 avatar Jun 02 '24 13:06 Cr0a3

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

This crate is basically abandoned

simbleau avatar Jun 04 '24 13:06 simbleau

Thanks

Cr0a3 avatar Jun 04 '24 18:06 Cr0a3