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
Fix false positive unconditional_recursion
#12062
Fix false positive unconditional_recursion
#12062
Conversation
r? @xFrednet (rustbot has picked a reviewer for you, use r? to override) |
Is there any reason for expression type constraints? The only thing that matters for recursion checking are the types of the lhs and rhs of the operator. |
Unless I missed something, we don't know which method is called just from here. It is much simpler to instead check the types of lhs and rhs and compare it with |
Sorry, I worded that badly. I meant the constraint that the lhs and rhs are both locals. |
Maybe this should should also check that there aren't any other explicit |
9626c5e
to
f3be069
Compare
You're right, it doesn't make much sense. I'll remove this check. @y21: That's a good point. I changed how I check it to ensure that there is no other return statements. If you have other test cases, please share them. :) |
☔ The latest upstream changes (presumably #11980) made this pull request unmergeable. Please resolve the merge conflicts. |
f3be069
to
1212a7d
Compare
1212a7d
to
7107aa2
Compare
Fixed merge conflict. |
LGTM, thank you for the update :D @bors r+ |
☀️ Test successful - checks-action_dev_test, checks-action_remark_test, checks-action_test |
How often are Clippy releases cut for nightly? I have a project where I use nightly rustc/clippy for various reasons, and I get this false positive even for |
I think it has been released so if you have a case, please open a new issue with a minimal code to reproduce it and tag me on it so I can fix it. |
Sure! Done: #12118. Thank you for your work on this! |
This is not synced yet. It will be synced tomorrow, so it will be in the nightly version of Friday 2024-01-12 |
So how does one figure out what version of the code one's clippy is running? Since I was running nightly and the date printed by |
You can't. Syncs are every other week on Thursday. This is documented in our book. So you have to know the Clippy sync process and how Rust releases work. We can't really give better version info, as the Clippy that is shipped with rustup is built in the Rust repo. And as far as that Clippy version is concerned, it is the one from that nightly. However, that version lacks behind by up to 2 weeks (by design). If there is an important fix, that blocks our users, we're open to requests to do an out-of-cylce sync, so that it gets into nightly earlier. But as the Clippy update is planned for tomorrow, I too lazy to do an additional sync today 😅 |
Thank you for the explanation! That makes sense and I understand doing it differently is hard/has other drawbacks! Optimally |
That's worth opening an issue to update |
FWIW, this is the command I'm using to find out the Clippy commit of the last sync in the Rust repo:
However, this depends on the exact commit message. If someone would change that during sync, this would no longer work. So using that to get more version information for |
Fixes #12052.
Only checking if both variables are
local
was not enough, we also need to confirm they have the same type asSelf
.changelog: Fix false positive for
unconditional_recursion
lint