-
Notifications
You must be signed in to change notification settings - Fork 2.7k
WIP: wrote 3 tests about improving the error message in the path dependency #16138
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
base: master
Are you sure you want to change the base?
WIP: wrote 3 tests about improving the error message in the path dependency #16138
Conversation
2a4dc4d to
2bf90ff
Compare
2bf90ff to
4d041ea
Compare
This comment has been minimized.
This comment has been minimized.
|
@epage I noticed that there were 7 spaces missing on both lines. So I added them and the test got passed. I have squashed and pushed the code, but these spaces are not showing. Maybe it's a GitHub thing. There is a conflict that came after your changes. Should I resolve the error by keeping this function or remove it?
|
82b2079 to
a12c57e
Compare
…directory and invalid_manifest_in_path made the tests pass by showing the current behaviour added generate-lockfile in the remaining two tests added the 7 spaces in the invalid_base to pass it and it got matched with the test before added 7 spaces to make the test pass
a12c57e to
9c538bb
Compare
src/cargo/core/resolver/errors.rs
Outdated
| use super::context::ResolverContext; | ||
| use super::types::{ConflictMap, ConflictReason}; | ||
|
|
||
| fn debug_source_path() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If these are for local debugging purpose, please remove.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was showing where they are at in experimenting while they then work to change this to fit in
| edition = "2015" | ||
| authors = [] | ||
| [workspace] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is [workspace] here essential? If not maybe we should remove.
| let gctx = GlobalContext::default().unwrap(); | ||
| let sid = SourceId::for_path(path).unwrap(); | ||
|
|
||
| fn debug_source_path(msg: &mut String, path: &Path, gctx: &GlobalContext, sid: SourceId) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These should go below where they are used so that the first item in the file is the starting point for reading it and going further down just adds more context
What does this PR try to resolve?
This PR is trying to improve the error message when the wrong package is found in the path dependency. Currently the PR started from the tests.
How to test and review this PR?
There are 3 tests added that cover each case that is brought up in this issue.
invalid_package_name_in_path()definitely_not_barexists in thecrates/barand it goes to thecrates/barto find that it is not present there and it gives the error.invalid_package_in_subdirectory()definitely_not_barexists in thecrates/barand after going there, it does not find it. Then it goes more deeper in thedefinitely_not_barto find that the manifest file exists there and give use the helpful message.invalid_manifest_in_path()definitely_not_barexists in thecrates/barbut after going there, it finds that there are other two packages butdefinitely_not_baris not present and it gives the message.