-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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
Updated metadata::creader::resolve_crate_deps to use the correct span #12146
Conversation
I'm not sure that this solves the bug at hand. The problem here is that you're loading the dependency of an explicitly mentioned crate, but you then fail to load the dependency. As implemented, you'll get an error message that looks like:
I agree that the span is probably pointing at the right location right now, but I think that the error message needs to be updated to fix the bug in question. Additionally, this change should be accompanied with a |
@alexcrichton Since #2404 is pretty light on details do you have any suggestions as to how to set up a test case to reproduce the error I'm trying to fix? My understanding of how crates are resolved/loaded is a work in progress. |
Try these steps:
The 4th step should have a message saying that A couldn't be found which is a dependency of B with a span pointing at |
Thanks. How should I modify the error message? Before correcting the FIXME I get:
After:
|
Something like:
|
Error message is now as follows:
|
This seems to look quite similar to the original version, perhaps a forgotten force-push? |
Sorry, should have said "Error message will be as follows". I'm still trying to figure out the best way to write a test for this. That I need to compile two crates and then delete one of them requires the Makefile functionality from tests/run-make. However, that isn't compatible with the requirement that this is a compile-fail test. Have any suggestions on this? |
Oh sorry, I'd change As for testing, the usual |
Changes are up now. |
// except according to those terms. | ||
|
||
extern mod crateB; | ||
//~^ ERROR can't find crate for `crateA` which `crateB` depends on |
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.
Sadly ERROR
directives are not parsed during the run-make
tests. I would recommend storing the output of rustc
and then invoking grep
to make sure that it printed a vaguely correct message.
Updated to be syntax agnostic. |
// Now resolve the crates referenced by this crate | ||
let cnum_map = resolve_crate_deps(e, metadata.as_slice()); | ||
let cnum_map = resolve_crate_deps(e, | ||
Some(root_crate.clone()), |
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.
You shouldn't have to clone()
here.
Looks good to me, thanks! Could you squash these commits together and make sure that |
…. Clarified error message when an external crate's dependency is missing. Closes rust-lang#2404.
Done. |
Addresses FIXME described in issue #2404
…s-with-dashes, r=Manishearth Fix [`multiple_crate_versions`] to correctly normalize package names to avoid missing the local one Fixes rust-lang#12145 changelog: [`multiple_crate_versions`]: correctly normalize package name
Addresses FIXME described in issue #2404