Skip to content

The warning diagnostics of the usage of std::intrinsics::copy_nonoverlapping is misleading #139505

Closed
@OscarTHZhang

Description

@OscarTHZhang

Code

fn main() {
    let a = 10;
    let mut b;
    unsafe {
        std::ptr::copy_nonoverlapping(a.as_ptr(), b.as_mut_ptr(), std::mem::sizeof::<i32>());
    }
}

Current output

use of deprecated module `std::intrinsics`: import this function via `std::mem` instead

Desired output

Either

use of deprecated module `std::intrinsics`: import this function via `std::ptr` instead

or
this function should be added into std::mem module.

Rationale and extra context

No response

Other cases

Rust Version

rustc 1.86.0 (872aa6e349 2025-04-01)
binary: rustc
commit-hash: 872aa6e34902620b5f406a0cbef652085a3c54b1
commit-date: 2025-04-01
host: x86_64-unknown-linux-gnu
release: 1.86.0
LLVM version: 19.1.7

Anything else?

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-diagnosticsArea: Messages for errors, warnings, and lintsT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions