Skip to content

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

Open
@lapla-cogito

Description

@lapla-cogito

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: Clippy is not doing the correct thingI-false-negativeIssue: The lint should have been triggered on code, but wasn't

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions