-
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
Update E0463 error message to new format #36060
Conversation
Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @jonathandturner (or someone else) soon. If any changes to this PR are deemed necessary, please add them as extra commits. This ensures that the reviewer can see what has changed since they last reviewed the code. Due to the way GitHub handles out-of-date commits, this should also make it reasonably obvious what issues have or haven't been addressed. Large or tricky changes may require several passes of review and changes. Please see the contribution instructions for more information. |
@@ -342,6 +343,7 @@ impl<'a> Context<'a> { | |||
"found crate `{}` compiled by an incompatible version of rustc{}", | |||
self.ident, add) | |||
} else { | |||
err_msg = format!("can't find crate"); | |||
struct_span_err!(self.sess, self.span, E0463, | |||
"can't find crate for `{}`{}", | |||
self.ident, add) |
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.
Rather than setting err_msg and using it later, you could instead set the label in the same condition. Maybe something like:
let mut err = struct_span_err!(self.sess, self.span, E0463,
"can't find crate for `{}`{}",
self.ident, add);
err.span_label(self.span, &format!("can't find crate"));
err
@paulfanelli - looks close. I added a comment of a way to tighten up the code. |
Oh man, I originally tried to code it that way, but I made a mistake, got a compiler error (it said there was a type mismatch between the if and else blocks) and thought that I couldn't code it that way. I tried your change -- and it works! Very nice. Definitely, learned a bunch of stuff from this one. Thx. |
I've updated the PR... |
36fc4b6
to
1b15ba3
Compare
Yeah, that looks a lot better. I think we're almost there. One last thing - can you squash your two commits down to one? With that I think we're ready. |
1b15ba3
to
58ced16
Compare
Ok, I've squashed them together...and updated this PR. |
Great, thanks. @bors r+ rollup |
📌 Commit 58ced16 has been approved by |
… r=jonathandturner Update E0463 error message to new format Fixes rust-lang#35934 as part of rust-lang#35233 r? @jonathandturner
… r=jonathandturner Update E0463 error message to new format Fixes rust-lang#35934 as part of rust-lang#35233 r? @jonathandturner
… r=jonathandturner Update E0463 error message to new format Fixes rust-lang#35934 as part of rust-lang#35233 r? @jonathandturner
Fixes #35934 as part of #35233
r? @jonathandturner