-
Notifications
You must be signed in to change notification settings - Fork 13.8k
Supress swapping lhs and rhs in equality suggestion in extern macro #144266
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?
Conversation
If the test can't actually demonstrate the change, then there's no reason to make this into two commits. Please squash this into one. |
2ec2014
to
749762a
Compare
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.
Pretty fast review!
@rustbot ready
if rhs_expr.span.in_external_macro(sm) || lhs_expr.span.in_external_macro(sm) { | ||
return; | ||
} | ||
|
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.
Now I checked both.
I submitted #144268. We can find the correct span with the newly added methods, thus not needing to suppress this suggestion. |
3abc2ff
to
68ea691
Compare
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.
Now, we could reproduce the bug.
@rustbot ready
This comment has been minimized.
This comment has been minimized.
r? compiler |
|
||
use std::fmt::Debug; | ||
|
||
macro_rules! eq_local { |
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 should fix these whitespace issues in the first commit.
This seems like it's doing what's it's supposed to. But it's papering over a problem, which is that the suggestion to switch the argument is incorrect -- it doesn't fix the problem. And this suggestion seems to be a new one. I don't get it in rust 1.89.0. It would be better if the suggestion wasn't given at all... |
@xizheyin any updates on this? thanks |
Signed-off-by: xizheyin <[email protected]>
Signed-off-by: xizheyin <[email protected]>
This PR was rebased onto a different master commit. Here's a range-diff highlighting what actually changed. Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers. |
Sorry for slow response! @Dylan-DPC @nnethercote :) I revised the code. My initial thinking was to provide different and more precise suggestions for user-written external libraries. However, for a minimal change, directly suppressing it is also a good approach. In this version, I directly suppressed the lhs and rhs from external macros because we cannot obtain precise spans. Additionally, I fixed the formatting issues in the first commit proposed by @nnethercote . |
Fixes #139050