Skip to content

Commit

Permalink
Merge #130
Browse files Browse the repository at this point in the history
130: Clarify docs regarding parking_lot r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <[email protected]>
  • Loading branch information
bors[bot] and matklad authored Dec 7, 2020
2 parents a648913 + e1d5db0 commit 6e30f21
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ members = ["xtask"]
[dependencies]
# Uses parking_lot to implement once_cell::sync::OnceCell.
# This makes not speed difference, but makes each OnceCell<T>
# for up to two bytes smaller, depending on the size of the T.
# for up to 16 bytes smaller, depending on the size of the T.
parking_lot = { version = "0.11", optional = true, default_features = false }

[dev-dependencies]
Expand Down
1 change: 1 addition & 0 deletions src/imp_std.rs
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,7 @@ mod tests {
}

#[test]
#[cfg(not(miri))]
fn stampede_once() {
static O: OnceCell<()> = OnceCell::new();
static mut RUN: bool = false;
Expand Down
9 changes: 5 additions & 4 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -233,10 +233,11 @@
//! and [`lazy_cell`](https://github.com/indiv0/lazycell/) crates and [`std::sync::Once`]. In some sense,
//! `once_cell` just streamlines and unifies those APIs.
//!
//! To implement a sync flavor of `OnceCell`, this crates uses either a custom re-implementation of
//! `std::sync::Once` or `parking_lot::Mutex`. This is controlled by the `parking_lot` feature, which
//! is enabled by default. Performance is the same for both cases, but the `parking_lot` based `OnceCell<T>`
//! is smaller by up to 16 bytes.
//! To implement a sync flavor of `OnceCell`, this crates uses either a custom
//! re-implementation of `std::sync::Once` or `parking_lot::Mutex`. This is
//! controlled by the `parking_lot` feature (disabled by default). Performance
//! is the same for both cases, but the `parking_lot` based `OnceCell<T>` is
//! smaller by up to 16 bytes.
//!
//! This crate uses `unsafe`.
//!
Expand Down

0 comments on commit 6e30f21

Please sign in to comment.