use lru_cache::LruCache;
fn main() {}
#[test]
fn test_panics() {
let mut l = LruCache::new(10);
l.insert(1, false);
}
cargo test
This code panics when the linked-hash-map crate used by lru_cache is under version 0.5.3, because it contains uninitialized memory allocation.
The uninitialized memory problem seems to be fixed for version 0.5.3, but because the dependency is specified in Cargo.toml as
linked-hash-map = "0.5"
It means that cargo is free to choose any version >=0.5.0, and if the 0.5.1 or 0.5.2 versions are present in the local package cache, they might be picked.
Rewriting it instead as
linked-hash-map = "0.5.3"
and releasing it as new minor version 0.1.3 would fix the problem, as cargo would be forced to pick a version >=0.5.3
Issue
This code panics when the
linked-hash-map
crate used bylru_cache
is under version 0.5.3, because it contains uninitialized memory allocation. The uninitialized memory problem seems to be fixed for version 0.5.3, but because the dependency is specified inCargo.toml
asIt means that cargo is free to choose any version
>=0.5.0
, and if the0.5.1
or0.5.2
versions are present in the local package cache, they might be picked.Rewriting it instead as
and releasing it as new minor version
0.1.3
would fix the problem, as cargo would be forced to pick a version>=0.5.3