mirror of
https://github.com/rust-lang/rust.git
synced 2025-11-17 11:58:12 +00:00
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