Skip to content

Commit

Permalink
Work well with older lock_api versions
Browse files Browse the repository at this point in the history
The crate `lock_api` is a transitive dependency, pulled in trough the
use of `parking_lot`. `parking_lot` depends on `lock_api` version
`^0.4.6`, but only since `lock_api` 0.4.7 the `RwLock::new()` method is
available on rust stable, coinciding with the release of rust
[1.61][const_fn_trait_bound].

A problem occurs if you try to use `once_map` with non-up-to-date
dependencies, e.g. by running

```sh
RUSTC_BOOTSTRAP=1 cargo generate-lockfile -Zminimal-versions
```

This PR adds an explicit dependency to `lock_api` 0.4.7. The dependency
is still optional and is only pulled in through feature `std`.
  • Loading branch information
Kijewski committed Aug 27, 2024
1 parent b9ca977 commit 152cb94
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ keywords = ["map", "once", "lazy"]
[features]
default = ["std", "ahash"]

std = ["dep:parking_lot", "stable_deref_trait/std", "ahash?/std", "ahash?/runtime-rng"]
std = ["dep:parking_lot", "dep:lock_api", "stable_deref_trait/std", "ahash?/std", "ahash?/runtime-rng"]
ahash = ["dep:ahash", "hashbrown/ahash"]

rayon = ["dep:rayon", "hashbrown/rayon", "std"]
Expand All @@ -31,6 +31,7 @@ equivalent = { version = "1.0", optional = true }

parking_lot = { version = "0.12", optional = true }
rayon = { version = "1.6", optional = true }
lock_api = { version = "0.4.7", optional = true }


[package.metadata.docs.rs]
Expand Down

0 comments on commit 152cb94

Please sign in to comment.