sharded-slab icon indicating copy to clipboard operation
sharded-slab copied to clipboard

Swap out lazy_static for once_cell

Open james7132 opened this issue 3 years ago • 15 comments

Fixes #71. Another benefit is that accessing registry's next counter doesn't require an extra lazy check, only on the actual freelist.

james7132 avatar Jun 06 '22 00:06 james7132

It looks like CI is stuck on this PR --- not totally sure what's going on there.

hawkw avatar Jun 07 '22 20:06 hawkw

Should we report this to GitHub? This seems like it's permanently stuck.

james7132 avatar Jun 09 '22 16:06 james7132

Looks like that was my fault; I changed the CI configuration, and it should run correctly now.

hawkw avatar Jun 09 '22 17:06 hawkw

@james7132 are you still intending to finish this (fix the two CI failures)?

jplatte avatar Sep 21 '22 09:09 jplatte

Looks like once_cell uses the 2021 edition, which has a MSRV of 1.56. Is this acceptable to bump the MSRV of this crate? or should I instead pin an earlier one that is compatible with this crate's MSRV of 1.42?

james7132 avatar Jan 10 '23 18:01 james7132

@hawkw ping about this question

james7132 avatar Feb 20 '23 04:02 james7132

@james7132 maybe just update the PR to get it to go green, since this would be a trivial change? Then there's a chance no further back and forth is needed when Eliza finds some time for this again.

jplatte avatar Feb 28 '23 18:02 jplatte

With syn 2.0.0 coming out bumping it's MSRV to 1.56, there's likely a bunch of crates bumping their MSRVs soon. Went ahead and updated the MSRV, added a rust_version field to Cargo.toml, and updated the CI workflow.

james7132 avatar Mar 18 '23 09:03 james7132

Also bumped the edition to 2021.

james7132 avatar Mar 18 '23 09:03 james7132

Loom seems to dislike once_cell's Lazy implementation. It's apparently unsupported right now, see https://github.com/tokio-rs/loom/issues/263.

james7132 avatar Mar 18 '23 10:03 james7132

Seems like parts of once_cell have been stabilized into std: https://github.com/rust-lang/rust/pull/105587.

james7132 avatar Apr 02 '23 01:04 james7132

Now that OnceLock is stable another possibility would be to use it instead but keep lazy_static as an optional feature for older compiler support

raftario avatar Aug 25 '23 22:08 raftario

Although you probably don't want to increase the MSRV that much for now, VecDeque::new() was made const in 1.68, so it'll be possible to remove lazy_static/once_cell usage altogether at some point.

Expyron avatar Nov 17 '23 18:11 Expyron

Any progress on this PR? I'm trying to purge lazy_static from my dependency tree.

notgull avatar Nov 25 '23 01:11 notgull

Now that OnceLock is stable another possibility would be to use it instead but keep lazy_static as an optional feature for older compiler support

This would be nice. Could be a default Cargo feature msrvXXXX that you can disable to get a lighter dependency tree at the expense of requiring a newer compiler.

jplatte avatar Nov 27 '23 10:11 jplatte