-
Notifications
You must be signed in to change notification settings - Fork 13.3k
After a hash mismatch error, emit file-system paths of crates involved. #13284
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
After a hash mismatch error, emit file-system paths of crates involved. #13284
Conversation
Fix rust-lang#13266. There is a little bit of acrobatics in the definition of `crate_paths` to avoid calling `clone()` on the dylib/rlib unless we actually are going to need them. The other oddity is that I have replaced the `root_ident: Option<&str>` parameter with a `root: &Option<CratePaths>`, which may surprise one who was expecting to see something like: `root: Option<&CratePaths>`. I went with the approach here because I could not come up with code for the alternative that was acceptable to the borrow checker.
@@ -338,7 +371,8 @@ impl<'a> Context<'a> { | |||
None => true, | |||
Some(myhash) => { | |||
if *myhash != hash { | |||
self.rejected_via_hash = true; | |||
self.rejected_via_hash = | |||
Some(ViaHash{ path: libpath.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.
This could also be a vector to collect all rejected candidates rather than just one (although most of the time there will only be one)
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.
I'll look into doing that
This should have a test in one of the test suites. There's an example in |
Add way to print notes with just file:linenum prefix (preserving integration with source lookup for e.g. vi and emacs) but don't repeat the other span info.
(i.e. semi-generalized version of prior errorinfo gathering.) Also revised presentation to put each path on its own line, prefixed by file:linenum information.
All it checks, unfortunately, is that you actually printed at least two lines for crateA paths and at least one line for crateB paths. But that's enough to capture the spirit of the bug, I think. I did not bother trying to verify that the paths themselves reflected where the crates end up.
So okay, the output now looks like this, when you run rustc on
|
…r=alexcrichton Fix #13266. There is a little bit of acrobatics in the definition of `crate_paths` to avoid calling `clone()` on the dylib/rlib unless we actually are going to need them. The other oddity is that I have replaced the `root_ident: Option<&str>` parameter with a `root: &Option<CratePaths>`, which may surprise one who was expecting to see something like: `root: Option<&CratePaths>`. I went with the approach here because I could not come up with code for the alternative that was acceptable to the borrow checker.
Improve `collapsible_match` error message syntax fixes rust-lang#13283 changelog: none
Fix #13266.
There is a little bit of acrobatics in the definition of
crate_paths
to avoid calling
clone()
on the dylib/rlib unless we actually aregoing to need them.
The other oddity is that I have replaced the
root_ident: Option<&str>
parameter with a
root: &Option<CratePaths>
, which may surprise onewho was expecting to see something like:
root: Option<&CratePaths>
.I went with the approach here because I could not come up with code for
the alternative that was acceptable to the borrow checker.