Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

manual_memcpy does not trigger when a loop uses an iterator #14009

Open
lapla-cogito opened this issue Jan 16, 2025 · 0 comments
Open

manual_memcpy does not trigger when a loop uses an iterator #14009

lapla-cogito opened this issue Jan 16, 2025 · 0 comments
Labels
C-bug Category: Clippy is not doing the correct thing I-false-negative Issue: The lint should have been triggered on code, but wasn't

Comments

@lapla-cogito
Copy link
Contributor

Summary

manual_memcpy doesn't trigger when an iterator is used within a for loop.

Lint Name

manual_memcpy

Reproducer

I tried this code:

let src = [0; 64];
let mut dst = [0; 128];
for (i, &val) in src.iter().enumerate() {
    dst[i + 64] = val;
}

I expected to see this happen: Pointing out memcpy is being re-implemented.

Instead, this happened: No warnings were emitted.

Version

rustc 1.86.0-nightly (a580b5c37 2025-01-08)
binary: rustc
commit-hash: a580b5c379b4fca50dfe5afc0fc0ce00921e4e00
commit-date: 2025-01-08
host: aarch64-apple-darwin
release: 1.86.0-nightly
LLVM version: 19.1.6
@lapla-cogito lapla-cogito added C-bug Category: Clippy is not doing the correct thing I-false-negative Issue: The lint should have been triggered on code, but wasn't labels Jan 16, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: Clippy is not doing the correct thing I-false-negative Issue: The lint should have been triggered on code, but wasn't
Projects
None yet
Development

No branches or pull requests

1 participant