about summary refs log tree commit diff
path: root/compiler/rustc_llvm/llvm-wrapper/CoverageMappingWrapper.cpp
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2024-01-27 18:20:06 +0000
committerbors <bors@rust-lang.org>2024-01-27 18:20:06 +0000
commit8ccf6a61eea595db738c8e764531848ae7bad0c3 (patch)
treeb2f4613a5fcf14bc98f9fca2b515ea1afa501e39 /compiler/rustc_llvm/llvm-wrapper/CoverageMappingWrapper.cpp
parent276ce3936bd7621f0cfda08fa070056dd6f43efb (diff)
parent03b3a16a8cac5c1573b630eb71c14ba2603af223 (diff)
downloadrust-8ccf6a61eea595db738c8e764531848ae7bad0c3.tar.gz
rust-8ccf6a61eea595db738c8e764531848ae7bad0c3.zip
Auto merge of #12084 - yuxqiu:manual_retain, r=Alexendoo
fix: incorrect suggestions generated by `manual_retain` lint

fixes #10393, fixes #11457, fixes #12081

#10393: In the current implementation of `manual_retain`, if the argument to the closure is matched using tuple, they are all treated as the result of a call to `map.into_iter().filter(<f>)`. However, such tuple pattern matching can also occur in many different containers that stores tuples internally. The correct approach is to apply different lint policies depending on whether the receiver of `into_iter` is a map or not.

#11457 and #12081: In the current implementation of `manual_retain`, if the argument to the closure is `Binding`, the closure will be used directly in the `retain` method, which will result in incorrect suggestion because the first argument to the `retain` closure may be of a different type. In addition, if the argument to the closure is `Ref + Binding`, the lint will simply remove the `Ref` part and use the `Binding` part as the argument to the new closure, which will lead to bad suggestion for the same reason. The correct approach is to detect each of these cases and apply lint suggestions conservatively.

changelog: [`manual_retain`] refactor and add check for various patterns
Diffstat (limited to 'compiler/rustc_llvm/llvm-wrapper/CoverageMappingWrapper.cpp')
0 files changed, 0 insertions, 0 deletions