**`Cargo.toml`**
[package]
name = "foo"
version = "0.1.0"
publish = false
edition = "2021"
[dependencies]
pulldown-cmark = { version = "0.12.2", default-features = false }
[target.'cfg(any(target_arch = "x86", target_arch = "x86_64"))'.dependencies]
pulldown-cmark = { version = "0.11", default-features = false, features = ["simd"] }
**`src/lib.rs`**
use pulldown_cmark;
Current output
Updating crates.io index
Locking 1 package to latest compatible version
Adding pulldown-cmark v0.11.3 (latest: v0.12.2)
Downloaded pulldown-cmark v0.11.3
Downloaded 1 crate (145.3 KB) in 0.09s
Compiling pulldown-cmark v0.11.3
Compiling pulldown-cmark v0.12.2
Compiling foo v0.1.0 (/tmp/foo)
error[E0464]: multiple candidates for `rmeta` dependency `pulldown_cmark` found
--> src/lib.rs:1:5
|
1 | use pulldown_cmark;
| ^^^^^^^^^^^^^^
|
= note: candidate #1: /tmp/foo/target/debug/deps/libpulldown_cmark-fad4c8962c375cb9.rmeta
= note: candidate #2: /tmp/foo/target/debug/deps/libpulldown_cmark-385191dabac2676c.rmeta
For more information about this error, try `rustc --explain E0464`.
error: could not compile `foo` (lib) due to 1 previous error
warning: build failed, waiting for other jobs to finish...
Desired output
error[Exxxx]: multiple candidates for dependency `pulldown_cmark` found
--> Cargo.toml:11:1
|
11 | pulldown-cmark = { version = "0.11", default-features = false, features = ["simd"] }
|
note: previous dependency declared here
--> Cargo.toml:8:1
|
8 | pulldown-cmark = { version = "0.12.2", default-features = false }
|
Rationale and extra context
From the above error message, I get the feeling that something happened within the rust compiler / package manager / whatever that placed something wrong in the target folder. However, it wasn't a problem with the contents of the target folder but with my dependencies. Therefore, the error message should point there.
Thanks for the report! I believe this is a duplicate of https://github.com/rust-lang/cargo/issues/8032, so closing in favor of that. Cargo should not be allowing multiple dependencies with the same name.
Code
Current output
Desired output
Rationale and extra context
From the above error message, I get the feeling that something happened within the rust compiler / package manager / whatever that placed something wrong in the
target
folder. However, it wasn't a problem with the contents of thetarget
folder but with my dependencies. Therefore, the error message should point there.Other cases
Rust Version
Anything else?
No response