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

Try to improve "version not found" error #6112

Merged
merged 1 commit into from
Oct 3, 2018

Conversation

alexcrichton
Copy link
Member

This commit tweaks the wording for when versions aren't found in a
source, notably including more location information other than the
source id but rather also taking into account replaced sources and such.
It's hoped that this gives more information to make it a bit more clear
what's going on.

Closes #6111

@rust-highfive
Copy link

r? @matklad

(rust_highfive has picked a reviewer for you, use r? to override)

Copy link
Contributor

@Eh2406 Eh2406 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall I like all improvements to the error messages and I like the method of plumbing the particular information thru. Thank you.

I just have a few nits, and diffs I did not expect.

required by package `bar v0.0.1`
... which is depended on by `foo [..]`
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why did this change? I am not objecting, just mechanically, what changed making us print which is depended on by?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh I just expanded the error message a bit here, only a subset of the output was previously tested with with_stderr_contains (vs with_stderr)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah. 👍

} else {
1024 // but locally try and find it in the one build
},
cases: 256,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why did you choose to change this?

I assume it was running to slowly locally. If that is correct can we atleast add back in a comment on how running repeatedly or increasing this number will increase the chance of finding a bug at the expense of time?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah yeah I found this was taking ~4m or so on my local machine which made a full test run sort of unbearable unfortunately :(. And sure I'll add a comment!

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That makes sense. It is new and we are still experimenting with how it fits into the workflow. I am ok with running fewer iterations, for the better ergonomics of running the test.

@@ -683,3 +683,44 @@ fn workspace_different_locations() {
",
).run();
}

#[test]
fn version_missing() {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In general the error messages are not nearly adequately tested. I'd like one day to be sure we have all the code branches tested. Thank you for adding this test!

location searched: {}\n\
versions found: {}\n",
dep.version_req(),
"failed to select a version for `{}` satisfying the requirement `{}`\n \
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I found this sentence structure convoluted the first time I looked at this PR, but it has grown on me. I thought about putting the concepts in the other order, but that leads to the existing wording which many people report as confusing.

A more radical thought is to use the cargo.toml syntax:
failed to select a version satisfying the requirement 'foo = "2"'
But I do not know if that is a good thought.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh I like that actually, everyone's quite familiar with it!

This commit tweaks the wording for when versions aren't found in a
source, notably including more location information other than the
source id but rather also taking into account replaced sources and such.
It's hoped that this gives more information to make it a bit more clear
what's going on.

Closes rust-lang#6111
@alexcrichton
Copy link
Member Author

Ok updated!

@Eh2406
Copy link
Contributor

Eh2406 commented Oct 2, 2018

Lgtm.

cc the last discussion of the error messages in #5452, although I can't quite map how our thoughts from then apply now.

@alexcrichton
Copy link
Member Author

Ok thanks! I'm all for any improvements to our error messages, so I'd be ok to review that again :)

@bors: r=Eh2406

@bors
Copy link
Contributor

bors commented Oct 2, 2018

📌 Commit 20cfb41 has been approved by Eh2406

@bors
Copy link
Contributor

bors commented Oct 2, 2018

⌛ Testing commit 20cfb41 with merge 2f0b0d4ccb30435ac6872caa8e7e57c874d23ce3...

@bors
Copy link
Contributor

bors commented Oct 3, 2018

💔 Test failed - status-travis

@alexcrichton
Copy link
Member Author

@bors: retry

bors added a commit that referenced this pull request Oct 3, 2018
Try to improve "version not found" error

This commit tweaks the wording for when versions aren't found in a
source, notably including more location information other than the
source id but rather also taking into account replaced sources and such.
It's hoped that this gives more information to make it a bit more clear
what's going on.

Closes #6111
@bors
Copy link
Contributor

bors commented Oct 3, 2018

⌛ Testing commit 20cfb41 with merge aa4cab3...

@bors
Copy link
Contributor

bors commented Oct 3, 2018

☀️ Test successful - status-appveyor, status-travis
Approved by: Eh2406
Pushing aa4cab3 to master...

@bors bors merged commit 20cfb41 into rust-lang:master Oct 3, 2018
@alexcrichton alexcrichton deleted the better-errors branch October 12, 2018 17:23
@ehuss ehuss added this to the 1.31.0 milestone Feb 6, 2022
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.

Error message should be more informative when build fails due to missing vendored dependencies
6 participants