diff options
| author | bors <bors@rust-lang.org> | 2023-12-16 18:21:01 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2023-12-16 18:21:01 +0000 |
| commit | 9907b90b1e014fb910c082612b2627dd375704fe (patch) | |
| tree | eaa6cc997c0cc7fc473d51fe8d266b941469a43e /tests/debuginfo/enum-thinlto.rs | |
| parent | b91843471717907abe2588cac98608dc23305584 (diff) | |
| parent | 6b444f3092bc9133bbbf67cc989b6dd74a228494 (diff) | |
| download | rust-9907b90b1e014fb910c082612b2627dd375704fe.tar.gz rust-9907b90b1e014fb910c082612b2627dd375704fe.zip | |
Auto merge of #11938 - GuillaumeGomez:unconditional_recursion, r=llogiq
Add new `unconditional_recursion` lint
Currently, rustc `unconditional_recursion` doesn't detect cases like:
```rust
enum Foo {
A,
B,
}
impl PartialEq for Foo {
fn eq(&self, other: &Self) -> bool {
self == other
}
}
```
This is because the lint is currently implemented only for one level, and in the above code, `self == other` will then call `impl PartialEq for &T`, escaping from the detection. The fix for it seems to be a bit tricky (I started investigating potential solution to add one extra level of recursion [here](https://github.com/rust-lang/rust/compare/master...GuillaumeGomez:rust:trait-impl-recursion?expand=1) but completely broken at the moment).
I expect that this situation will remain for a while. In the meantime, I think it's acceptable to check it directly into clippy for the time being as a lot of easy cases like this one can be easily checked (next I plan to extend it to cover other traits like `ToString`).
changelog: Add new `unconditional_recursion` lint
Diffstat (limited to 'tests/debuginfo/enum-thinlto.rs')
0 files changed, 0 insertions, 0 deletions
