about summary refs log tree commit diff
path: root/library/std/src/lazy.rs
AgeCommit message (Collapse)AuthorLines
2022-10-08Remove empty core::lazy and std::lazyest31-1/+0
PR #98165 with commits 7c360dc117d554a11f7193505da0835c4b890c6f and c1a2db3372a4d6896744919284f3287650a38ab7 has moved all of the components of these modules into different places, namely {std,core}::sync and {std,core}::cell. The empty modules remained. As they are unstable, we can simply remove them.
2022-06-16Move/rename `lazy::Sync{OnceCell,Lazy}` to `sync::{Once,Lazy}Lock`Maybe Waffle-616/+0
2021-10-10Add #[must_use] to core and std constructorsJohn Kugelman-0/+1
2021-08-17Constified `Default` implementationsDeadbeef-1/+2
The libs-api team agrees to allow const_trait_impl to appear in the standard library as long as stable code cannot be broken (they are properly gated) this means if the compiler teams thinks it's okay, then it's okay. My priority on constifying would be: 1. Non-generic impls (e.g. Default) or generic impls with no bounds 2. Generic functions with bounds (that use const impls) 3. Generic impls with bounds 4. Impls for traits with associated types For people opening constification PRs: please cc me and/or oli-obk.
2021-08-01Write docs for SyncOnceCell From and Default implMichael Howell-0/+30
2021-03-27Use DebugStruct::finish_non_exhaustive() in std.Mara Bos-1/+1
2021-02-28Clarify that SyncOnceCell::set blocks.Erik Jensen-1/+4
Reading the discussion of this feature, I gained the mistaken impression that neither `set` nor `get` blocked, and thus calling `get` immediately after `set` was not guaranteed to succeed. It turns out that `set` *does* block, guaranteeing that the cell contains a value once `set` returns. This change updates the documentation to state that explicitly.
2021-02-24library: Normalize safety-for-unsafe-block commentsMiguel Ojeda-3/+7
Almost all safety comments are of the form `// SAFETY:`, so normalize the rest and fix a few of them that should have been a `/// # Safety` section instead. Furthermore, make `tidy` only allow the uppercase form. While currently `tidy` only checks `core`, it is a good idea to prevent `core` from drifting to non-uppercase comments, so that later we can start checking `alloc` etc. too. Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
2020-12-08Add (internal-only) SyncOnceCell::get_or_init_pin.Mara Bos-0/+55
2020-09-12Simplify SyncOnceCell's `take` and `drop`.Mara Bos-26/+13
2020-09-08Capitalize safety commentsFlying-Toast-3/+3
2020-09-05Add compile_fail test for SyncOnceCell's dropck issue.Mara Bos-1/+19
2020-09-05Fix dropck issue of SyncOnceCell.Mara Bos-1/+8
Fixes #76367.
2020-09-01Auto merge of #76047 - Dylan-DPC:rename/maybe, r=RalfJungbors-2/+2
rename get_{ref, mut} to assume_init_{ref,mut} in Maybeuninit References #63568 Rework with comments addressed from #66174 Have replaced most of the occurrences I've found, hopefully didn't miss out anything r? @RalfJung (thanks @danielhenrymantilla for the initial work on this)
2020-08-31std: move "mod tests/benches" to separate filesLzu Tao-330/+3
Also doing fmt inplace as requested.
2020-08-29rename get_{ref, mut} to assume_init_{ref,mut} in MaybeuninitDPC-2/+2
2020-08-25Suggest `mem::forget` if `mem::ManuallyDrop::new` isn't usedScott McMurray-1/+1
I think this communicates the intent better, and is shorter anyway.
2020-08-19Rollup merge of #75696 - matklad:mirit, r=RalfJungTyler Mandry-24/+4
Remove `#[cfg(miri)]` from OnceCell tests They were carried over from once_cell crate, but they are not entirely correct (as miri now supports more things), and we don't run miri tests for std, so let's just remove them. Maybe one day we'll run miri in std, but then we can just re-install these attributes.
2020-08-19Remove `#[cfg(miri)]` from OnceCell testsAleksey Kladov-24/+4
They were carried over from once_cell crate, but they are not entirely correct (as miri now supports more things), and we don't run miri tests for std, so let's just remove them. Maybe one day we'll run miri in std, but then we can just re-install these attributes.
2020-08-18Make OnceCell<T> transparent to dropckAleksey Kladov-2/+12
See the failed build in https://github.com/rust-lang/rust/pull/75555#issuecomment-675016718 for an example where we need this in real life
2020-07-28Fix RefUnwindSafe & UnwinsSafe impls for lazy::SyncLazyAleksey Kladov-1/+3
The logic here is the same as for Send&Sync impls.
2020-07-27mv std libs to library/mark-0/+846