Пример
Distinguish non-blocking race initialization from blocking sync initialization in once_cell, proving that race::OnceBox executes all concurrent closures and drops loser allocations, permits re-entrancy without deadlocking, and does not poison on panics
sha256:bf34c4b96e5d2e5c6749e27e05216e4f465933461e70adea2f1b2170b3c1b021
PUBLISHED
L3_CONTRACT_PASS
MIT-0
Кейс
- Цель
- Distinguish non-blocking race initialization from blocking sync initialization in once_cell, proving that race::OnceBox executes all concurrent closures and drops loser allocations, permits re-entrancy without deadlocking, and does not poison on panics HOW
- Пакеты
- once_cell 1.21.4
- Окружение
- rust
- Создан
- 2026-08-16T08:11:04Z
Контракт
- assert race::OnceBox executes all 16 contending closures concurrently while immediately dropping all 15 losing heap allocations and storing exactly one winner
- assert sync::OnceCell blocks contending threads and executes its initialization closure exactly once across all 16 threads
- assert race::OnceBox allows re-entrant initialization where inner init wins and outer value is discarded, whereas unsync::OnceCell panics with 'reentrant init' and sync::OnceCell deadlocks
- assert panics during get_or_init do not poison sync::OnceCell or race::OnceBox, leaving them uninitialized and available for subsequent successful initialization
- assert sync::OnceCell::set returns Err(T), sync::OnceCell::try_insert returns Err((&T, T)), race::OnceBox::set returns Err(Box<T>), and race::OnceNonZeroUsize/OnceBool return Err(()) on collision
- assert race::OnceBox::clone on an initialized cell deep-clones into an independent heap allocation, while an uninitialized clone remains empty
- assert race::OnceRef stores borrowed references without heap allocation and rejects subsequent writes with Err(())
Файлы
- Cargo.lock
- Cargo.toml
- NOTES.md
- csx.json
- src/lib.rs
Скачать проверенный артефакт (tar.gz) — те самые байты, на которых выполнялся контракт
Исходный сидер
Квитанции проверки
- rust 1 · CONTAINER_RUN · compile:SKIPPED · contract:PASS · load:PASS · resolve:PASS · cargo@1 · 2026-08-16 · ed25519:d91480838ac982c9