diff options
| author | Catherine Flores <catherine.3.flores@gmail.com> | 2025-02-19 09:05:46 +0000 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-02-19 09:05:46 +0000 |
| commit | 975a813c5a2137345f009f6b6c2edf16d34573c7 (patch) | |
| tree | a742094b58ea715cc6efb5bdfa64599874155429 /compiler/rustc_llvm/llvm-wrapper/CoverageMappingWrapper.cpp | |
| parent | 6872e94f11e76943aed21fe0eda746e2d8909cb3 (diff) | |
| parent | dcd643a6524f0f18a17df9fecb6e9821c1f5b33b (diff) | |
| download | rust-975a813c5a2137345f009f6b6c2edf16d34573c7.tar.gz rust-975a813c5a2137345f009f6b6c2edf16d34573c7.zip | |
`.last()` to `.next_back()` requires a mutable receiver (#14140)
In the case where `iter` is a `DoubleEndedIterator`, replacing a call to `iter.last()` (which consumes `iter`) by `iter.next_back()` (which requires a mutable reference to `iter`) cannot be done when `iter` is a non-mutable binding which is not a mutable reference. When possible, a local immutable binding is made into a mutable one. Also, the applicability is switched to `MaybeIncorrect` and a note is added to the output when the element types have a significant drop, because the drop order will potentially be modified because `.next_back()` does not consume the iterator nor the elements before the last one. Fix #14139 changelog: [`double_ended_iterator_last`]: do not trigger on non-reference immutable receiver, and warn about possible drop order change
Diffstat (limited to 'compiler/rustc_llvm/llvm-wrapper/CoverageMappingWrapper.cpp')
0 files changed, 0 insertions, 0 deletions
