-
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
Consider borrowing here: &0
#52544
Comments
The problem is by the time this error is emittedwe don't have the information about the root cause anymore. In this case that would be the type of Clippy has a lint that will tell you to clean it up afterwards, but we should probably issue a better diagnostic to begin with. |
fn main() {
let i: &i64 = &1;
if i < 0 {}
} |
Please excuse my naïvety, but why is this (according to csmoes MCVE) a problem? You can actually write
and everything works just fine. Can you please explain this part (to me)? |
The comparison operator already takes references to both sides. so it seems simpler to dereference the lhs and save the monomorphizer and the optimizer some effort |
Resurrecting this. @oli-obk what're the benefits of dereferencing the lhs instead of referencing the rhs? Also, if I were to go about fixing this, where would I start? |
The benefit is that I'm not sure how to solve this or whether we should try at all. |
@rustbot claim |
I want to get started with this, but would appreciate some mentoring from someone before I do, to point me in the right direction please |
There's a reason I marked this as |
*cue terminator background music * Lol in all seriousness, if someone wants to claim this up, feel free to. Until then, I'll try and fix this. |
Hi, are you still working on this issue @rakshith-ravi? |
Hey @Alexendoo. I've been meaning to fix this up. I've reached a point where I know exactly how to fix this as well. I just haven't found the time to fix this. Feel free to take it up, considering I wouldn't be having the time to work on this in the forseeable future. |
@rustbot release-assignment If do you find the time in the future, please claim this issue again. Until then I'll free it up in case anybody else wants it |
Is anyone currently working on this? If not, I'd be happy to give it a go. @rustbot claim |
Rollup merge of rust-lang#117893 - sjwang05:issue-52544-take-1, r=wesleywiser Suggest dereferencing the LHS for binops such as `&T == T` Fixes rust-lang#52544
What I actually wanted was
*i
.The text was updated successfully, but these errors were encountered: