rust-random / rand

A Rust library for random number generation.
https://crates.io/crates/rand
Other
1.67k stars 432 forks source link

Failure to compile version 0.8.5 #1522

Closed tjb7 closed 3 weeks ago

tjb7 commented 3 weeks ago

Loose use statement causes compilation failure

Problem: When compiling version 0.8.5 I get the following error:

error[E0432]: unresolved import `rand`
  --> xxxx/registry/src/index.crates.io-6f17d22bba15001f/rand-0.8.5/src/rng.rs:17:5
   |
17 | use rand::Rng;
   |     ^^^^ use of undeclared crate or module `rand`

Quick solution: just commenting out the line allows compilation to proceed

Details: MacOS, cargo 1.81.0 (2dbb1af80 2024-08-20)

newpavlov commented 3 weeks ago

The problem is most certainly on your side. As you can see here rand v0.8.5 does not contain the problematic line and rand can be used on the playground without issues. You may have unintentionally modified cached version of the crate. Try to clear the index folder and compile your project again.

tjb7 commented 3 weeks ago

Makes sense, thanks, I did not realize that cargo clean does not remove these files.