In building rust, I see there are two version of rand have been downloaded into my CARGO_HOME directory, one is 0.6.1, one is 0.7.0. I aslo see the layout of the souce code is quite differnt than what we can see from https://github.com/rust-random/rand.
So my quesiton is how/where rust fetch the rand crate source code? In other word, if I want to add something to rand and build it with rust, how should I setup my work environment so the rust could use my local rand copy?
Sorry if I didn't say it more clearly, I am talking about the problem what I have seen in building rust from source because I am trying to port rust for a OS. Shouldn't such question be posted here?
You can use a [patch] section as @matklad mentioned in rust's own Cargo.toml. Given the mix of rand versions though, you might need to use corresponding versions in a [replace] section instead.
As for the rand repo, note that it's a workspace of all of the rand crates, whereas you'll have fetched them individually from crates.io when building rust. You may have to dig in the history and branches to find the published versions you want to modify.
Updating only changed submodules
Submodules updated in 0.02 seconds
error: failed to parse manifest at `/home/bpang/rust_rand/rust/Cargo.toml`
Caused by:
cannot specify both [replace] and [patch]
Glad that it helps! And yeah, questions about building rust compiler itself are definitely a good fit for this forum, sorry for misreading your question!