rust/clippy_utils/src/mir
bors 0dc265ff82 Auto merge of #12756 - y21:assigning_clones_lifetimes, r=Alexendoo
Avoid emitting `assigning_clones` when cloned data borrows from the place to clone into

Fixes #12444
Fixes #12460
Fixes #12749
Fixes #12757
Fixes #12929

I think the documentation for the function should describe what- and how this is fixing the issues well.
It avoids emitting a warning when the data being cloned borrows from the place to clone into, which is information that we can get from `PossibleBorrowerMap`. Unfortunately, it is a tiny bit tedious to match on the MIR like that and I'm not sure if this is possibly relying a bit too much on the exact MIR lowering for assignments.

Things left to do:
- [x] Handle place projections (or verify that they work as expected)
- [x] Handle non-`Drop` types

changelog: [`assigning_clones`]: avoid warning when the suggestion would lead to a borrow-check error
2024-06-15 18:25:42 +00:00
..
mod.rs Merge commit '9725c4a162' into clippy-subtree-update 2024-04-04 19:52:55 +02:00
possible_borrower.rs Auto merge of #12756 - y21:assigning_clones_lifetimes, r=Alexendoo 2024-06-15 18:25:42 +00:00
possible_origin.rs Merge commit '5436dba826' into clippyup 2023-07-31 23:53:53 +02:00
transitive_relation.rs Merge commit '4f142aa105' into clippyup 2022-10-23 15:18:45 +02:00