rust-lang / rust

Empowering everyone to build reliable and efficient software.
https://www.rust-lang.org
Other
95.7k stars 12.33k forks source link

Tracking Issue for `lazy_cell_into_inner` #125623

Open tspiteri opened 2 months ago

tspiteri commented 2 months ago

This superceded #109736 now that the lazy_cell feature has been stabilized.

Feature gate: #[feature(lazy_cell_into_inner)]

This is a tracking issue for LazyCell::into_inner and LazyLock::into_inner.

Public API

// core::cell (in core/src/cell/lazy.rs)

impl<T, F: FnOnce() -> T> LazyCell<T, F> {
    pub fn into_inner(this: Self) -> Result<T, F>;
}
// std::sync (in std/sync/lazy_lock.rs)

impl<T, F: FnOnce() -> T> LazyLock<T, F> {
    pub fn into_inner(this: Self) -> Result<T, F>;
}

Steps / History

Unresolved Questions

workingjubilee commented 2 months ago

@tspiteri Would you be so kind as to make the tracking issue? (you could even just edit this one) We can edit it from there if we need to change things.

tgross35 commented 3 weeks ago

Could this be renamed to lazy_cell_into_inner? I keep thinking this is is referencing an API that uses atomic consume operations, which was discussed for the implementation of OnceLock/LazyLock but ultimately rejected (e.g. here).

workingjubilee commented 3 weeks ago

Go for it.

tgross35 commented 3 weeks ago

I was mostly asking for someone to rename the issue, but here we go https://github.com/rust-lang/rust/pull/127599. Rustbot has really been spot on picking reviewers for me recently.