Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rand_core 0.2.2: a compatibility shim around 0.3 #619

Merged
merged 2 commits into from
Oct 3, 2018

Conversation

dhardy
Copy link
Member

@dhardy dhardy commented Oct 2, 2018

This is necessary where multiple dependencies use differing
versions of rand_core but need the same RngCore etc.

Unfortunately this fails with:

$ cargo test --package rand_core:0.2.2
    Finished dev [unoptimized + debuginfo] target(s) in 0.02s                                                                          
     Running target/debug/deps/rand_core-547dfb477b3cced4

running 0 tests

test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out

   Doc-tests rand_core
error[E0465]: multiple rlib candidates for `rand_core` found
  --> /home/dhardy/projects/rand/rand/rand_core/src/lib.rs:48:1
   |
48 | extern crate rand_core as core3;
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
note: candidate #1: /home/dhardy/projects/rand/rand/target/debug/deps/librand_core-f12b3d8f22720790.rlib
  --> /home/dhardy/projects/rand/rand/rand_core/src/lib.rs:48:1
   |
48 | extern crate rand_core as core3;
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
note: candidate #2: /home/dhardy/projects/rand/rand/target/debug/deps/librand_core-c567b6644b6189ab.rlib
  --> /home/dhardy/projects/rand/rand/rand_core/src/lib.rs:48:1
   |
48 | extern crate rand_core as core3;
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

error[E0463]: can't find crate for `core3`
  --> /home/dhardy/projects/rand/rand/rand_core/src/lib.rs:48:1
   |
48 | extern crate rand_core as core3;
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ can't find crate

error: test failed, to rerun pass '--doc'

I can't work out why — @alexcrichton?

I can work around with rust-lang/cargo#5653 but that requires nightly.

This is necessary where multiple dependencies use differing
versions of rand_core but need the same RngCore etc.
@alexcrichton
Copy link
Contributor

This is a limitation of Cargo where if you depend on the same-named crate you can't use doctests. There's unfortunately no great way to solve this. Eventually when Cargo has stabilized renaming dependencies it should be possible to get this working again

@dhardy
Copy link
Member Author

dhardy commented Oct 3, 2018

Thanks for the tip; I disabled doc-tests here. It's a hack, but having this compatibility shim is quite important for users I think.

@dhardy dhardy merged commit 8648fec into rust-random:core-0.2 Oct 3, 2018
@dhardy dhardy deleted the core-0.2 branch October 3, 2018 09:46
dhardy added a commit that referenced this pull request Jan 25, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants