-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Infinite loop in clippy::only_used_in_recursion
#8689
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
Comments
One of the full backtrace that I got (it's not always at the exact same place) is the following:
|
Demangled:
|
I spotted out the expression that causes the infinite recursion: https://github.com/stepfunc/dnp3/blob/da807bc2bbf682ecb5ebf773c0a19cf5ff71b817/ffi/dnp3-schema/src/database.rs#L915-L964 I'm also not really sure if it is actually a infinite recursion or if it just takes a really long time. About the lint itself: I tried to read the code of the lint for over an hour now and couldn't really follow what it is doing. I was also able to remove large junks of code from the visitor and the tests kept passing. This signals to me that the logic the lint code is following isn't really tested. The tests that are there could mostly also be linted with simpler linting code. Also there is a test, that with slight modifications produces a FP: rust-clippy/tests/ui/only_used_in_recursion.rs Lines 28 to 38 in b3bd03a
If you add a I think we should just bail out if the parameter is used anywhere other than directly as its own function argument. I also have the suspicion that even in cases where this lint doesn't get into an infinite loop it might be a significant perf regression for Clippy. I think we will have to remove this lint from Clippy for now. I like this lint in general, but I think in the current state it is over engineered and not really maintainable. cc @llogiq @buttercrab maybe you can provide more insights what's going on in this lint. |
Maybe I should rewrite the lint from the beginning. |
Looking at it again: I think it is actually not an infinite loop, but the complexity of the linting code is in But I still think this lint either needs way more tests or it should be rewritten. Starting with simpler linting code and then try to improve the lint rather than trying to catch all convoluted cases from the get go. |
Summary
Since 1.61.0-beta.1, one of our crate gets stuck in an infinite loop. I was able to GDB into clippy and figure out that it gets stuck while running the
clippy::only_used_in_recursion
that was recently introduced. Unfortunately, I was not able to understand why it gets stuck.Reproducer
Running
cargo +beta clippy
on thednp3-schema
crate gets stuck in an infinite loop in 1.61.0-beta.1 and up (including nightly)Version
Additional Labels
No response
The text was updated successfully, but these errors were encountered: