diff options
| author | bors <bors@rust-lang.org> | 2024-02-07 16:18:33 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2024-02-07 16:18:33 +0000 |
| commit | 62dcbd672bbf1ae6fc5df793e63b849692cfa3c4 (patch) | |
| tree | 1d6ed213f2c4ed8d1a32da69b4f741c5a4bf921b /compiler/rustc_llvm/llvm-wrapper/CoverageMappingWrapper.cpp | |
| parent | 08c8cd501454a6976ce4803bae5ef6aa2879028f (diff) | |
| parent | 87a6300b22725bfea57f0e4fb95ccf70ed7d8cc8 (diff) | |
| download | rust-62dcbd672bbf1ae6fc5df793e63b849692cfa3c4.tar.gz rust-62dcbd672bbf1ae6fc5df793e63b849692cfa3c4.zip | |
Auto merge of #12177 - y21:issue12154, r=Jarcho
[`unconditional_recursion`]: compare by `Ty`s instead of `DefId`s Fixes #12154 Fixes #12181 (this was later edited in, so the rest of the description refers to the first linked issue) Before this change, the lint would work with `DefId`s and use those to compare types. This PR changes it to compare types directly. It fixes the linked issue, but also other false positives I found in a lintcheck run. For example, one of the issues is that some types don't have `DefId`s (primitives, references, etc., leading to possible FNs), and the helper function used to extract a `DefId` didn't handle type parameters. Another issue was that the lint would use `.peel_refs()` in a few places where that could lead to false positives (one such FP was in the `http` crate). See the doc comment on one of the added functions and also the test case for what I mean. The code in the linked issue was linted because the receiver type is `T` (a `ty::Param`), which was not handled in `get_ty_def_id` and returned `None`, so this wouldn't actually *get* to comparing `self_arg != ty_id` here, and skip the early-return: https://github.com/rust-lang/rust-clippy/blob/70573af31eb9b8431c2e7923325c82ba0304cbb2/clippy_lints/src/unconditional_recursion.rs#L171-L178 This alone could be fixed by doing something like `&& get_ty_def_id(ty).map_or(true, |ty_id)| self_arg != ty_id)`, but we don't really need to work with `DefId`s in the first place, I don't think. changelog: [`unconditional_recursion`]: avoid linting when the other comparison type is a type parameter
Diffstat (limited to 'compiler/rustc_llvm/llvm-wrapper/CoverageMappingWrapper.cpp')
0 files changed, 0 insertions, 0 deletions
