There's not a huge amount of infrastructure to generate meaningful errors in resolve, and the errors are likely difficult to read and interpret. Need to invest some time into figuring out error conditions, producing high quality errors, and implementing it.
There is some code for errors, but I'm dubious of the quality of it.
Just to add another example of someone having trouble parsing these types of errors: http://www.reddit.com/r/rust/comments/2w6scv/regex_macros_from_cratesio_seems_to_be_broken/
Minimal steps to reproduce this (I think?):
coreyf@frewbook-pro /tmp> cargo new --bin someproject
coreyf@frewbook-pro /tmp> cd someproject/
coreyf@frewbook-pro /t/someproject (master)> echo 'objc-foundation = "0.0.2"' >> Cargo.toml
coreyf@frewbook-pro /t/someproject (master)> cargo build
Updating registry `https://github.com/rust-lang/crates.io-index`
Compiling libc v0.1.12
Compiling block v0.1.4
Compiling libc v0.2.4
Compiling malloc_buf v0.0.6
Compiling objc v0.1.8
Compiling objc_id v0.0.2
Compiling objc-foundation v0.0.2
Compiling someproject v0.1.0 (file:///private/tmp/someproject)
coreyf@frewbook-pro /t/someproject (master)> cargo update -p "objc-foundation" --precise 0.0.4
Updating registry `https://github.com/rust-lang/crates.io-index`
no matching package named `objc-foundation` found (required by `someproject`)
location searched: registry https://github.com/rust-lang/crates.io-index
version required: ^0.0.2
versions found: 0.0.4
@frewsxcv that error message is expected: Cargo considers 0.0.4聽is incompatible with 0.0.2. This gave me a lead for #2293, and I think the cause is the same although the error message there is bad. You need to change https://github.com/aweinstock314/rust-clipboard/blob/master/Cargo.toml
@SimonSapin how about this:
coreyf@frewbook-pro /tmp> cargo new --bin someproject
coreyf@frewbook-pro /tmp> cd someproject/
coreyf@frewbook-pro /t/someproject (master)>
echo 'objc-foundation = "~0.0.2"' >> Cargo.toml
coreyf@frewbook-pro /t/someproject (master)> cargo build
Updating registry `https://github.com/rust-lang/crates.io-index`
Downloading objc-foundation v0.0.4
Compiling block v0.1.4
Compiling libc v0.2.4
Compiling malloc_buf v0.0.6
Compiling objc v0.1.8
Compiling objc-foundation v0.0.4
Compiling someproject v0.1.0 (file:///private/tmp/someproject)
coreyf@frewbook-pro /t/someproject (master)>
cargo update -p "objc-foundation" --precise 0.0.4
Updating registry `https://github.com/rust-lang/crates.io-index`
no matching package named `objc` found (required by `objc-foundation`)
location searched: registry https://github.com/rust-lang/crates.io-index
version required: = 0.1.8
Thanks for the minimized test case @frewsxcv! Your thoughts on #2293 were correct in that I don't believe it was related to that bug at all. In any case, however, I've now submitted a fix for this bug
Awesome, thanks!
@alexcrichton removed P-high on this inactive bug.
@brson sounds good to me
This is still quite obscure when you've never hit a resolve error and don't know to run cargo update:
>cargo build
error: failed to select a version for `syn` (required by `serde_derive_internals`):
all possible versions conflict with previously selected versions of `syn`
version 0.11.9 in use by syn v0.11.9
possible versions to select: 0.11.11, 0.11.10
Files for test case: test_resolve_syn.zip
Regardless if this is a bug and is fixed, it'd be great for new users hitting a resolve error to be suggested to run cargo update.
Yes. It is especially obscure when the dep is a dep-of-a-dep
We also had the unfortunate situation of not being able to upgrade deps independently:
nipunn-mbp:engine nipunn$ cargo update -p libc
Updating registry `https://github.com/rust-lang/crates.io-index`
error: failed to select a version for `gcc` (required by `chromedebugger`):
all possible versions conflict with previously selected versions of `gcc`
version 0.3.38 in use by gcc v0.3.38
possible versions to select: 0.3.45
nipunn-mbp:engine nipunn$ cargo update -p gcc
Updating registry `https://github.com/rust-lang/crates.io-index`
error: failed to select a version for `libc` (required by `sync`):
all possible versions conflict with previously selected versions of `libc`
version 0.2.20 in use by libc v0.2.20
possible versions to select: 0.2.22
nipunn-mbp:engine nipunn$ cargo update -p libc
Updating registry `https://github.com/rust-lang/crates.io-index`
error: failed to select a version for `gcc` (required by `events`):
all possible versions conflict with previously selected versions of `gcc`
version 0.3.38 in use by gcc v0.3.38
possible versions to select: 0.3.45
This situation was caused by a git merge conflict in the Cargo.lock. I rolled back the Cargo.lock to head and tried to resolve by merging the Cargo.tomls and ended up here.
Got out of it by doing cargo update, but it updated way more things (10x more) than I hoped to achieve today. We have 100s of deps, so doing a full cargo update is a bit scary.
I did not know about cargo update. Had to google for the
rust failed to select a version for
libc
error and then do a bit of reading to figure out what is happening.
If someone wants to point me to where one would have to start in order to generate a PR for improving this, I'd be happy to spend some time on it.
@seeekr all of resolution happens in this module, but there's unfortunately not really an easy way to jump in right now :(
Move to close, error messages have gotten better and there are other open issues about it.
Agreed!
Most helpful comment
This is still quite obscure when you've never hit a resolve error and don't know to run
cargo update:Files for test case: test_resolve_syn.zip
Regardless if this is a bug and is fixed, it'd be great for new users hitting a resolve error to be suggested to run
cargo update.