If a project (most likely indirectly through dependencies) depends on both version 0.14.x and 0.15.x of hashbrown, and only one of the two dependencies has the nightly feature flag set, the project will fail to compile due to using the allocator_api without enabling the unstable feature for it:
error[E0658]: use of unstable library feature 'allocator_api'
--> /Users/orlp/.cargo/registry/src/index.crates.io-6f17d22bba15001f/hashbrown-0.14.5/src/raw/mod.rs:4329:23
|
4329 | alloc.deallocate(ptr, layout);
| ^^^^^^^^^^
|
= note: see issue #32838 <https://github.com/rust-lang/rust/issues/32838> for more information
= help: add `#![feature(allocator_api)]` to the crate attributes to enable
= note: this compiler was built on 2024-10-02; consider upgrading it if it is out of date
This can be reproduced by making a clean new project and adding the following two lines to Cargo.toml:
hashbrown_14 = { package = "hashbrown", version = "=0.14.5", features = [] }
hashbrown_15 = { package = "hashbrown", version = "=0.15.0", features = ["nightly"] }
If it's just one of the two the project compiles fine, regardless of the nightly feature flag. If neither or both have the nightly feature flag everything compiles fine as well. However if one has the nightly feature flag and the other does not, the project doesn't compile.
If a project (most likely indirectly through dependencies) depends on both version 0.14.x and 0.15.x of hashbrown, and only one of the two dependencies has the
nightlyfeature flag set, the project will fail to compile due to using theallocator_apiwithout enabling the unstable feature for it:This can be reproduced by making a clean new project and adding the following two lines to
Cargo.toml:If it's just one of the two the project compiles fine, regardless of the
nightlyfeature flag. If neither or both have thenightlyfeature flag everything compiles fine as well. However if one has thenightlyfeature flag and the other does not, the project doesn't compile.