specifying different versions in unconditional and target-specific dependency sections causes "multiple rmeta candidates" error
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 15.5k
- Forks
- 3k
- Avg merge
- 23h 30m
- Merged PRs (30d)
- 51
Description
Problem
In a situation like:
[dependencies]
lazy_static = "1"
[target.'cfg(not(windows))'.dependencies]
lazy_static = "0.2"
cargo tries to include both lazy_static libraries, which fails with a "multiple rmeta candidates" error because it can't pick the right library.
Steps
git clone https://github.com/sunshowers/cargo-bug-multiversion
cd cargo-bug-multiversion
cargo doc
or uncomment the line in src/lib.rs then run cargo build.
Possible Solution(s)
Ideally this situation would be detected by cargo, at least when it notices that it's about to put multiple conflicting library paths in the same command.
I guess this is similar to the whole specialization issue in Rust, so if we wawnt to get fancy enough maybe non-overlapping specializations could be allowed?
Notes
Output of cargo version:
cargo 1.42.0 (86334295e 2020-01-31)
This is with the standard rustup stable toolchain on MacOS.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Clone the linked cargo-bug-multiversion reproducer, then run cargo doc and, after uncommenting the line in src/lib.rs, cargo build to observe the multiple rmeta candidates error. Trace how Cargo handles the unconditional and target-specific dependency declarations; done means conflicting library paths are detected and reported clearly or otherwise handled without the compilation failure.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- build-system
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100