샘플
once_cell 1.21.4: Decide what still needs once_cell now that std has OnceLock, LazyLock, cell::OnceCell and cell::LazyCell, by measuring which once_cell APIs have a stable std equivalent on this rustc and which are still gated
검증된 샘플 — cargo once_cell 1.21.4: Decide what still needs once_cell now that std has OnceLock, LazyLock, cell::OnceCell and cell::LazyCell, by measuring which…
sha256:36b55cf55782c3258dcb2509e721eb8edf4affdd15e52754fe01d12bb5fa27c9
이 네트워크가 제공하는 것은 하나입니다. 빌드되는 샘플. 샌드박스에서 돌리고 서명된 영수증을 보관합니다. 등급을 매기지 않고 무엇도 보증하지 않습니다 — 같은 코드가 당신 환경에서 빌드되는지는 측정한 적이 없습니다.
통과한 계약 영수증을 낸 서로 다른 서명 키의 수입니다. 하나면 작성자 혼자이고, 둘 이상이면 다른 사람도 빌드했다는 뜻입니다. 키는 스스로 만드는 것이고 뒤에 등록된 신원이 없으므로, 세는 것은 사람이 아니라 키입니다.
MIT-0
실행 증거
선언된 환경과 서명된 실행을 분리해 두었습니다. 이 샘플이 무엇을 어디서 실행했는지 그대로 볼 수 있습니다.
- 증거 기준
- 서명된 컨트랙트 통과
- 검증 영수증
- 2
- 빌드한 서명 키
- 2
선언된 환경
rust 1 linux x64 rust 1 rust cargo
검증 실행 환경
| 환경 | 컨트랙트 | 단계 | 실행일 |
|---|---|---|---|
| rust 1 · linux alpine/x64 · docker ed25519:a2ec939a4c60e243 | PASS | compile:SKIPPED · contract:PASS · load:PASS · resolve:PASS CONTAINER_RUN · cargo@1 |
2026-08-14 |
| rust 1 · linux alpine/x64 · docker ed25519:d91480838ac982c9 | PASS | compile:SKIPPED · contract:PASS · load:PASS · resolve:PASS CONTAINER_RUN · cargo@1 |
2026-08-18 |
케이스
MIGRATION- 목표
- Decide what still needs once_cell now that std has OnceLock, LazyLock, cell::OnceCell and cell::LazyCell, by measuring which once_cell APIs have a stable std equivalent on this rustc and which are still gated
- 패키지
- 심벌
-
- std::sync::OnceLock
- OnceLock::set
- OnceLock::get_or_init
- OnceLock::take
- std::sync::LazyLock
- LazyLock::force
- LazyLock::force_mut
- std::cell::OnceCell
- std::cell::LazyCell
- once_cell::sync::OnceCell
- once_cell::sync::OnceCell::get_or_try_init
- once_cell::sync::Lazy
- once_cell::unsync::OnceCell
- 환경
- rust 1
- 생성일
- 2026-08-14T13:27:13Z
컨트랙트
- assert a second OnceLock::set neither panics nor overwrites, and hands the rejected value straight back inside Err while the first value stays put
- assert get_or_init on an already filled cell never calls its closure, and that take() needs &mut so a shared cell stays write-once
- assert once_cell::sync::OnceCell::set has the identical hands-it-back contract
- assert get_or_init runs its closure exactly once when 16 threads arrive together, counted with an AtomicUsize, and that every thread leaves with the winner's value
- assert set() called by the same 16 threads instead runs 16 times, returns exactly one Ok, and hands every loser its own value back rather than the winner's
- assert a LazyLock static has not run its initialiser before the first deref, and runs it exactly once across 8 threads doing 1000 lookups each
- assert LazyLock::force hands back the same allocation as deref, and that once_cell::sync::Lazy builds the same table with the same laziness
- assert std LazyLock implements DerefMut and force_mut on this rustc, so neither is a once_cell-only feature any more
- assert a const LazyLock compiles and re-runs its initialiser once per use site: three uses, three builds, no warning
- assert once_cell::sync::Lazy in a const does exactly the same, so the trap belongs to const and not to the crate
- assert the same three uses of a static LazyLock build once and hand out a single address
- assert std::cell::OnceCell and std::cell::LazyCell cover once_cell::unsync, with the same set/get contract and the same first-use laziness
- assert the measured sizes: the unsync cell saves nothing over OnceLock for a u32 and eight bytes for a String
- compile a probe file with rustc to prove OnceLock::get_or_try_init is E0658 behind the once_cell_try feature, tracking issue 109737
- compile a probe file with rustc to prove OnceLock::try_insert is E0658 behind the once_cell_try_insert feature
- compile probe files with rustc to prove OnceLock::wait and LazyLock::force_mut do compile on this rustc
- compile a probe file with rustc to prove std::cell::OnceCell is not Sync, with rustc naming std::sync::OnceLock as the replacement
- assert once_cell's get_or_try_init leaves the cell empty after a failed init so the next caller retries, and stops calling the closure once one succeeds
- assert the hand-rolled get-then-set stand-in runs its initialiser once per thread, 16 out of 16, while still handing every caller the same value
파일
- Cargo.lock
- Cargo.toml
- csx.json
- src/main.rs