I'm learning rust. As part of the guessing game tutorial, I downloaded the rand crate. I am concerned about dependency confusion, and do not wish to download any more packages than absolutely necessary.
Therefore, I set my Cargo.toml
to:
[dependencies]
rand = "=0.5.5"
However, I noticed that 3 different versions of rand_core were downloaded, as well as libc.
Updating crates.io index
Downloaded rand_core v0.3.1
Downloaded rand_core v0.4.2
Downloaded rand v0.5.5
Downloaded rand_core v0.2.2
Downloaded libc v0.2.87
Downloaded 5 crates (702.2 KB) in 1.17s
Compiling libc v0.2.87
Compiling rand_core v0.4.2
Compiling rand_core v0.3.1
Compiling rand_core v0.2.2
Compiling rand v0.5.5
Compiling guessing_game v0.1.0 (/home/user/projects/learn-rust/guessing_game)
Finished dev [unoptimized + debuginfo] target(s) in 26.19s
Running `target/debug/guessing_game`
I went to the dependencies page for rand 0.5.5 on crates.io, and found that:
- rand 0.5.5 depends on
- rand_core ^0.2 (I downloaded 0.2.2) depends on
- rand_core ^0.3 (I downloaded 0.3.1) depends on
- rand_core ^0.4 (I downloaded 0.4.2).
However, no required dependency on libc anywhere.
Why am I downloading libc?
rand
needs 3 different versions ofrand_core
as dependancies. According to the description 3 versions ofrand_core
are indeed downloaded, but I only find 1 line of^0.2 rand_core
in dependencies page for rand 0.5.5. – rustyhu