Crate features / once_cell
Feature flags · once_cell 1.21.4 · from crates.io 2026-10-24
once_cell features: what each one does, and the line to copy
Short answeronce_cell 1.21.4 has 8 features. By default it turns on std; add default-features = false to start from nothing. It needs Rust 1.65 or newer.
Pick features
Every feature
| Feature | In default | Turns on |
|---|---|---|
alloc | race | |
atomic-polyfill | critical-section | |
critical-section | dep:critical-section, portable-atomic | |
parking_lot | dep:parking_lot_core | |
portable-atomic | dep:portable-atomic | |
race | nothing else (a switch the code checks) | |
std | yes | alloc |
unstable | nothing else (a switch the code checks) |
dep:x turns on the optional dependency x; x/y turns on feature y of dependency x (with ?, only if x is already on).
MSRV history
The minimum Rust version once_cell declares (rust-version), and the release that changed it:
- 1.15.0-pre.1 (2022-09-15): Rust 1.56
- 1.18.0 (2023-06-04): Rust 1.60
- 1.21.0 (2025-03-10): Rust 1.70
- 1.21.1 (2025-03-13): Rust 1.65
Stuck on an older compiler? Pin the last version that supports it, for example cargo update -p once_cell --precise <version>, or use resolver 3, which picks compatible versions for you.
More on once_cell
docs.rs feature list · crates.io · license MIT OR Apache-2.0 · edition 2021
Up next
Next crateFeature flags for every popular crateRead it next →Also worth your time
Did this answer your question?