os-rust/library/std
Guillaume Gomez fcd75ccc90
Rollup merge of #116540 - daxpedda:once-cell-lock-try-insert, r=Mark-Simulacrum
Implement `OnceCell/Lock::try_insert()`

I took inspiration from [`once_cell`](https://crates.io/crates/once_cell):
- [`once_cell::unsync::OnceCell::try_insert()`](874f9373ab/src/lib.rs (L551-L563))
- [`once_cell::sync::OnceCell::try_insert()`](874f9373ab/src/lib.rs (L1080-L1087))

I tried to change as little code as possible in the first commit and applied some obvious optimizations in the second one.

ACP: https://github.com/rust-lang/libs-team/issues/276
Tracking issue: #116693
2023-10-14 22:35:05 +02:00
..
benches mv std libs to library/ 2020-07-27 19:51:13 -05:00
src Rollup merge of #116540 - daxpedda:once-cell-lock-try-insert, r=Mark-Simulacrum 2023-10-14 22:35:05 +02:00
tests Add data race test to std::env::{get, set} 2023-08-20 21:50:45 +02:00
build.rs Revert "Invoke backtrace-rs buildscript in std buildscript" 2023-10-13 13:43:00 -06:00
Cargo.toml Revert "Invoke backtrace-rs buildscript in std buildscript" 2023-10-13 13:43:00 -06:00