Skip to content

multiple matching crates when deps are duplicated #18

@colin-kiegel

Description

@colin-kiegel

I get a weird error when I use the combination of:

  • rust-skeptic
  • cargo check
  • cargo test
  • on a proc_macro crate

This looks like a skeptic (or cargo check) bug and it is dependent on the order of cargo check and cargo test.

error[E0464]: multiple matching crates for `cargo_check_bug`
 --> /tmp/rust-skeptic.U89a9gBDNE36/test.rs:1:1
  |
1 | extern crate cargo_check_bug;
  | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  |
  = note: candidates:
  = note: path: /home/colin/projects/rust/cargo_check_bug/target/debug/deps/libcargo_check_bug-0b76af5b42a4f158.so
  = note: crate name: cargo_check_bug
  = note: crate name: cargo_check_bug

Steps to reprodroduce

  1. git clone https://github.com/colin-kiegel/cargo_check_bug.git
  2. cd cargo_check_bug
  3. rustup override set nightly-2017-03-03
  4. cargo clean && cargo test && cargo check
  5. cargo clean && cargo check && cargo test

Result of Step 4

Everything OK!
   Compiling getopts v0.2.14
   Compiling libc v0.2.21
   Compiling bitflags v0.5.0
   Compiling rand v0.3.15
   Compiling pulldown-cmark v0.0.8
   Compiling tempdir v0.3.5
   Compiling skeptic v0.7.1
   Compiling cargo_check_bug v0.1.0 (file:///home/colin/projects/rust/cargo_check_bug)
    Finished dev [unoptimized + debuginfo] target(s) in 5.40 secs
     Running target/debug/deps/cargo_check_bug-bc124838e21e68e1

running 0 tests

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

 Running target/debug/deps/skeptic-c3b458a20ebee641

running 1 test
warning: proc macro crates and #[no_link] crates have no effect without #[macro_use]
--> /tmp/rust-skeptic.9IqFqNCvwCPZ/test.rs:1:1
|
1 | extern crate cargo_check_bug;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

test readme_0 ... ok

test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured

Doc-tests cargo_check_bug

running 0 tests

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

Compiling cargo_check_bug v0.1.0 (file:///home/colin/projects/rust/cargo_check_bug)
Finished dev [unoptimized + debuginfo] target(s) in 0.12 secs

Result of Step 5

error[E0464]: multiple matching crates for `cargo_check_bug`
   Compiling bitflags v0.5.0
   Compiling getopts v0.2.14
   Compiling libc v0.2.21
   Compiling rand v0.3.15
   Compiling pulldown-cmark v0.0.8
   Compiling tempdir v0.3.5
   Compiling skeptic v0.7.1
   Compiling cargo_check_bug v0.1.0 (file:///home/colin/projects/rust/cargo_check_bug)
    Finished dev [unoptimized + debuginfo] target(s) in 4.54 secs
   Compiling cargo_check_bug v0.1.0 (file:///home/colin/projects/rust/cargo_check_bug)
    Finished dev [unoptimized + debuginfo] target(s) in 0.97 secs
     Running target/debug/deps/cargo_check_bug-bc124838e21e68e1

running 0 tests

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

 Running target/debug/deps/skeptic-c3b458a20ebee641

running 1 test
error[E0464]: multiple matching crates for cargo_check_bug
--> /tmp/rust-skeptic.U89a9gBDNE36/test.rs:1:1
|
1 | extern crate cargo_check_bug;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: candidates:
= note: path: /home/colin/projects/rust/cargo_check_bug/target/debug/deps/libcargo_check_bug-0b76af5b42a4f158.so
= note: crate name: cargo_check_bug
= note: crate name: cargo_check_bug

error[E0463]: can't find crate for cargo_check_bug
--> /tmp/rust-skeptic.U89a9gBDNE36/test.rs:1:1
|
1 | extern crate cargo_check_bug;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ can't find crate

error: aborting due to 2 previous errors

test readme_0 ... FAILED

failures:

---- readme_0 stdout ----
thread 'readme_0' panicked at 'Command failed:
"rustc" "/tmp/rust-skeptic.U89a9gBDNE36/test.rs" "--verbose" "-o" "/tmp/rust-skeptic.U89a9gBDNE36/out.exe" "--crate-type=bin" "-L" "/home/colin/projects/rust/cargo_check_bug/target/debug" "-L" "/home/colin/projects/rust/cargo_check_bug/target/debug/deps" "--extern" "pulldown_cmark=/home/colin/projects/rust/cargo_check_bug/target/debug/deps/libpulldown_cmark-ecfb67e72dcb6fb2.rlib" "--extern" "skeptic=/home/colin/projects/rust/cargo_check_bug/target/debug/deps/libskeptic-74b6fcba1ef2d3dc.rlib" "--extern" "getopts=/home/colin/projects/rust/cargo_check_bug/target/debug/deps/libgetopts-3facdbd0235704b0.rlib" "--extern" "tempdir=/home/colin/projects/rust/cargo_check_bug/target/debug/deps/libtempdir-0ee757a585f719dd.rlib" "--extern" "libc=/home/colin/projects/rust/cargo_check_bug/target/debug/deps/liblibc-5dc7b85e748840b4.rlib" "--extern" "bitflags=/home/colin/projects/rust/cargo_check_bug/target/debug/deps/libbitflags-8510a47beebe00a6.rlib" "--extern" "rand=/home/colin/projects/rust/cargo_check_bug/target/debug/deps/librand-c9d9fbdab2355ee4.rlib"', /home/colin/.cargo/registry/src/github.com-1ecc6299db9ec823/skeptic-0.7.1/lib.rs:391
note: Run with RUST_BACKTRACE=1 for a backtrace.

failures:
readme_0

test result: FAILED. 0 passed; 1 failed; 0 ignored; 0 measured

error: test failed

Cargo.toml

[package]
name = "cargo_check_bug"
version = "0.1.0"
build = "build.rs"

[lib]
proc-macro = true

[dependencies]

[build-dependencies]
skeptic = "0.7"

[dev-dependencies]
skeptic = "0.7"

build.rs

extern crate skeptic;

fn main() {
    skeptic::generate_doc_tests(&["README.md"]);
}

README.md

```rust
extern crate cargo_check_bug;

fn main() {
}
```

tests/skeptic.rs

include!(concat!(env!("OUT_DIR"), "/skeptic-tests.rs"));

src/lib.rs

#![crate_type = "proc-macro"]
extern crate proc_macro;
use proc_macro::TokenStream;

#[proc_macro_derive(Foo)]
pub fn derive(_input: TokenStream) -> TokenStream {
    unimplemented!()
}

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions