Skip to content

Cargo rand compilation errors #5972

@rida914-4

Description

@rida914-4

Hi,

This is a general cargo question as a beginner.

I have a rust code which uses rand so i add rand="0.4.3" as a dependency. Idk why when the registry updates randv0.5.5(latest) is automatically downloaded and it also runs into "break loop" error which was stabilized a while ago. I am not sure how to suppress this error or make it not install the latest version.

Cargo.toml
[package]
name = "hello-world"
version = "0.0.0"
authors = [""]

[dependencies]
time = ">=0.1.0"
rand = "0.4.3"
rustc-serialize = "0.3"
histogram = "*"

I get this error. The repository is not cloned locally so i cannot apply the patch rust-lang/rust#37339.

Compiling rand v0.5.5
error: break with a value is experimental (see issue #37339)
--> /root/.cargo/registry/src/git.colasdn.top-1ecc6299db9ec823/rand-0.5.5/src/distributions/uniform.rs:674:25
|
674 | break d;
| ^^^^^^^
|
= help: add #![feature(loop_break_value)] to the crate attributes to enable

error: pub(restricted) syntax is experimental (see issue #32409)
--> /root/.cargo/registry/src/git.colasdn.top-1ecc6299db9ec823/rand-0.5.5/src/distributions/float.rs:71:5
|
71 | pub(crate) trait IntoFloat {
| ^^^^^
|
= help: add #![feature(pub_restricted)] to the crate attributes to enable

error: pub(restricted) syntax is experimental (see issue #32409)
--> /root/.cargo/registry/src/git.colasdn.top-1ecc6299db9ec823/rand-0.5.5/src/rngs/mod.rs:174:27
|
174 | #[cfg(feature="std")] pub(crate) mod thread;
| ^^^^^
|
= help: add #![feature(pub_restricted)] to the crate attributes to enable

error: aborting due to 3 previous errors

error: Could not compile rand.

What am i doing wrong? What is the right way to go about it?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions