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

Consider removing dependency on LazyCell #9310

Open
nox opened this issue Mar 28, 2021 · 2 comments
Open

Consider removing dependency on LazyCell #9310

nox opened this issue Mar 28, 2021 · 2 comments
Labels
A-cargo-api Area: cargo-the-library API and internal code issues C-bug Category: bug S-triage Status: This issue is waiting on initial triage.

Comments

@nox
Copy link
Contributor

nox commented Mar 28, 2021

There is a slight risk of race condition with LazyCell because of its API design, it may be a good idea to replace its uses with OnceCell.

@nox nox added the C-bug Category: bug label Mar 28, 2021
@ehuss ehuss added the A-cargo-api Area: cargo-the-library API and internal code issues label Mar 30, 2021
@dtolnay
Copy link
Member

dtolnay commented Nov 2, 2023

The race condition applies only to AtomicLazyCell, not the non-Sync LazyCell. AtomicLazyCell is not used by Cargo.

In any case, these days LazyCell is superseded by https://doc.rust-lang.org/1.73.0/std/cell/struct.OnceCell.html.

@epage
Copy link
Contributor

epage commented Nov 2, 2023

#12616 at least removed our use of lazy_static for OnceCell. I think the lazy cell uses weren't as straightforward so they were skipped when doing that opportunistic refactor.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-cargo-api Area: cargo-the-library API and internal code issues C-bug Category: bug S-triage Status: This issue is waiting on initial triage.
Projects
None yet
Development

No branches or pull requests

4 participants