Skip to content

rand is unusable due to crate incompatibilities #531

Closed
@orlp

Description

@orlp

The current rand crates included in the playground are:

rand = "=0.7.0"
rand_chacha = "=0.2.1"
rand_core = "=0.5.0"
rand_hc = "=0.2.0"
rand_isaac = "=0.1.1"
rand_jitter = "=0.1.4"
rand_os = "=0.1.3"
rand_pcg = "=0.1.2"
rand_xorshift = "=0.1.1"

I haven't checked all of them, but this makes the Pcg and XorShift RNGs unusable because they are outdated, and they are using an older version of rand_core. E.g.:

use rand_core::SeedableRng;
use rand_pcg::Pcg32;
fn main() {
    let _r = Pcg32::seed_from_u64(42);
}

This complains:

error[E0599]: no function or associated item named `seed_from_u64` found for type `rand_pcg::pcg64::Lcg64Xsh32` in the current scope
 --> src/main.rs:4:21
  |
4 |     let _r = Pcg32::seed_from_u64(42);
  |                     ^^^^^^^^^^^^^ function or associated item not found in `rand_pcg::pcg64::Lcg64Xsh32`
  |
  = help: items from traits can only be used if the trait is in scope
help: the following trait is implemented but not in scope, perhaps add a `use` for it:
  |
1 | use rand_core::SeedableRng;
  |

warning: unused import: `rand_core::SeedableRng`
 --> src/main.rs:1:5
  |
1 | use rand_core::SeedableRng;
  |     ^^^^^^^^^^^^^^^^^^^^^^
  |
  = note: `#[warn(unused_imports)]` on by default

error: aborting due to previous error

For more information about this error, try `rustc --explain E0599`.
error: Could not compile `playground`.

To learn more, run the command again with --verbose.

Due to incompatible crate versions.

Metadata

Metadata

Assignees

No one assigned

    Labels

    upstreamCaused by a third-party component

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions