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

Replace once_cell crate from librustc_datastructures with an (unstable) impl from std #75700

Closed
matklad opened this issue Aug 19, 2020 · 9 comments · Fixed by #76075
Closed
Labels
E-mentor Call for participation: This issue has a mentor. Use #t-compiler/help on Zulip for discussion.

Comments

@matklad
Copy link
Member

matklad commented Aug 19, 2020

After #75648 is merged, usage of once_cell in this module:

https://github.com/rust-lang/rust/blob/5b04bbfcbb79ed7325ea2b580458a80d95da6bbb/src/librustc_data_structures/sync.rs

should be replaced by std::[OnceCell|SyncOnceCell]. The dependency from corresponding Cargo.toml can be removed afterwards.

It might make sense to request a perf run, as crates.io version uses parking_lot, while the standard one uses std mutex, but I expect the difference to not matter -- fast path is equivalent for both.

@matklad matklad added the E-mentor Call for participation: This issue has a mentor. Use #t-compiler/help on Zulip for discussion. label Aug 19, 2020
@KodrAus KodrAus changed the title Replace once_cell crate from ibrustc_datastructures with an (usntable) impl from std Replace once_cell crate from ibrustc_datastructures with an (unstable) impl from std Aug 19, 2020
@marmeladema
Copy link
Contributor

@bors claim

@matklad matklad changed the title Replace once_cell crate from ibrustc_datastructures with an (unstable) impl from std Replace once_cell crate from librustc_datastructures with an (unstable) impl from std Aug 19, 2020
@matklad
Copy link
Member Author

matklad commented Aug 19, 2020

#75648 is done!

Though, I am not unsure if we maybe should wait until it tickles down to beta? Not sure how bootstraping works with libstd, I guess, we can just try and see if the build fails.

@Mark-Simulacrum
Copy link
Member

The compiler always builds with the in-tree standard library, so cfg(bootstrap) should never be necessary (beyond lints, and other compiler-implemented rather than library-implemented) details.

@matklad
Copy link
Member Author

matklad commented Aug 27, 2020

ping @marmeladema, this is ready to be implemented.

@marmeladema
Copy link
Contributor

I'll start soon! Sorry I got a bit overwhelmed with work. If in the next couple of days I haven't replied feel free to re-assign.

@marmeladema
Copy link
Contributor

On it!

@marmeladema
Copy link
Contributor

@matklad once this is merged, should other sub-crates that depend on once_cell also be updated? Like librustc_interface for example. Also, what about lazy_static? Some usage can probably be replaced by Lazy.

@matklad
Copy link
Member Author

matklad commented Aug 29, 2020

We definitely should actively remove once_cell crate from all rustc’s crates, because having two difference sources of the same data structure feels bad.

Replacing lazy_static with std::lazy would also be good!

@marmeladema
Copy link
Contributor

We definitely should actively remove once_cell crate from all rustc’s crates, because having two difference sources of the same data structure feels bad.

Replacing lazy_static with std::lazy would also be good!

I'll try to take of it once this issue is fixed 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
E-mentor Call for participation: This issue has a mentor. Use #t-compiler/help on Zulip for discussion.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants