diff options
| author | bors <bors@rust-lang.org> | 2024-03-01 12:05:03 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2024-03-01 12:05:03 +0000 |
| commit | e865dca4d76a204e002c223cba1dc804ee9b7c56 (patch) | |
| tree | ff8f7737fa15ec62f90aa2fb111deb36e32ccac5 /compiler/rustc_codegen_llvm/src | |
| parent | 225d3771d744acc59b2a8cd778259bd3aa2383cf (diff) | |
| parent | dfedadc179dc3c388e0b0098a910658bc6e820ef (diff) | |
| download | rust-e865dca4d76a204e002c223cba1dc804ee9b7c56.tar.gz rust-e865dca4d76a204e002c223cba1dc804ee9b7c56.zip | |
Auto merge of #12010 - granddaifuku:fix/manual-memcpy-indexing-for-multi-dimension-arrays, r=Alexendoo
fix: `manual_memcpy` wrong indexing for multi dimensional arrays
fixes: #9334
This PR fixes an invalid suggestion for multi-dimensional arrays.
For example,
```rust
let src = vec![vec![0; 5]; 5];
let mut dst = vec![0; 5];
for i in 0..5 {
dst[i] = src[i][i];
}
```
For the above code, Clippy suggests `dst.copy_from_slice(&src[i]);`, but it is not compilable because `i` is only used to loop the array.
I adjusted it so that Clippy `manual_memcpy` works properly for multi-dimensional arrays.
changelog: [`manual_memcpy`]: Fixes invalid indexing suggestions for multi-dimensional arrays
Diffstat (limited to 'compiler/rustc_codegen_llvm/src')
0 files changed, 0 insertions, 0 deletions
