Repository navigation
Labels
C-tracking-issueCategory: An issue tracking the progress of sth. like the implementation of an RFCCategory: An issue tracking the progress of sth. like the implementation of an RFCT-libs-api[DEPRECATED; DO NOT USE][DEPRECATED; DO NOT USE]disposition-mergeThis issue / PR is in PFCP or FCP with a disposition to merge it.This issue / PR is in PFCP or FCP with a disposition to merge it.finished-final-comment-periodThe final comment period is finished for this PR / Issue.The final comment period is finished for this PR / Issue.
Milestone
Description
Feature gate: #![feature(lazy_get)]
This is a tracking issue for LazyCell/Lock::get[_mut](), allowing you to extract a reference from a Lazy only if it is initialized, approved in ACP rust-lang/libs-team#429.
Public API
impl<T, F> core::cell::LazyCell<T, F> {
pub fn get(this: &Self) -> Option<&T>;
pub fn get_mut(this: &mut Self) -> Option<&mut T>;
pub fn force_mut(this: &mut Self) -> &mut T;
}
impl<T, F> std::sync::LazyLock<T, F> {
pub fn get(this: &Self) -> Option<&T>;
pub fn get_mut(this: &mut Self) -> Option<&mut T>;
pub fn force_mut(this: &mut Self) -> &mut T;
}Steps / History
- ACP:
LazyLock/Cellget_mut()andDerefMutlibs-team#429 - Implementation:
- Final comment period (FCP)1
- Stabilization PR
Unresolved Questions
- None yet.
Footnotes
Reacted by Nazar Mokrynskyi, Chaoses-Ib, Aimar Seminario, José Luis Cruz and Zeke Fast
Metadata
Metadata
Assignees
Labels
C-tracking-issueCategory: An issue tracking the progress of sth. like the implementation of an RFCCategory: An issue tracking the progress of sth. like the implementation of an RFCT-libs-api[DEPRECATED; DO NOT USE][DEPRECATED; DO NOT USE]disposition-mergeThis issue / PR is in PFCP or FCP with a disposition to merge it.This issue / PR is in PFCP or FCP with a disposition to merge it.finished-final-comment-periodThe final comment period is finished for this PR / Issue.The final comment period is finished for this PR / Issue.
Activity
Rollup merge of rust-lang#130476 - workingjubilee:more-lazy-methods-t…
Rollup merge of rust-lang#130476 - workingjubilee:more-lazy-methods-t…
Unrolled build for rust-lang#130476
jalil-salame commentedon Nov 29, 2024
The docs for
LazyLock::get[_mut]are backwards:LazyLock::get:LazyLock::get_mut:The examples are right through.
ChayimFriedman2 commentedon Nov 29, 2024
@jalil-salame Why is that backwards? That seems correct to me.
jalil-salame commentedon Nov 29, 2024
Get should get a reference not a mutable reference
Get mut should get a mutable reference not a reference
Rollup merge of rust-lang#134452 - jalil-salame:fix-lazy-cell-docs, r…
Rollup merge of rust-lang#134452 - jalil-salame:fix-lazy-cell-docs, r…
Rollup merge of rust-lang#134452 - jalil-salame:fix-lazy-cell-docs, r…
Unrolled build for rust-lang#134452
kornelski commentedon Mar 8, 2025
get/get_mut have been fixed. Can this be stabilized now?
Rollup merge of rust-lang#134452 - jalil-salame:fix-lazy-cell-docs, r…
Amanieu commentedon Apr 29, 2025
FCP to stabilize
get.get_mutandforce_mut.@rfcbot merge
33 remaining items
Rollup merge of rust-lang#150016 - usamoi:stabilize-lazy-get, r=jhpratt
Rollup merge of rust-lang#150016 - usamoi:stabilize-lazy-get, r=jhpratt
Rollup merge of rust-lang#150016 - usamoi:stabilize-lazy-get, r=jhpratt
Unrolled build for #150016
Migrate from once_cell::sync::Lazy to std::sync::LazyLock.
Migrate from once_cell::sync::Lazy to std::sync::LazyLock.
Rollup merge of #150016 - usamoi:stabilize-lazy-get, r=jhpratt
Migrate from once_cell::sync::Lazy to std::sync::LazyLock.
Migrate from once_cell::sync::Lazy to std::sync::LazyLock.
Migrate from once_cell::sync::Lazy to std::sync::LazyLock.
Migrate from once_cell::sync::Lazy to std::sync::LazyLock.
Migrate from once_cell::sync::Lazy to std::sync::LazyLock.
Migrate from once_cell::sync::Lazy to std::sync::LazyLock.