Skip to content

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

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

Closed
OscarTHZhang opened this issue Apr 8, 2025 · 2 comments · Fixed by #139526
Labels
A-diagnostics Area: Messages for errors, warnings, and lints T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@OscarTHZhang
Copy link

OscarTHZhang commented Apr 8, 2025

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

@OscarTHZhang OscarTHZhang added A-diagnostics Area: Messages for errors, warnings, and lints T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Apr 8, 2025
@OscarTHZhang OscarTHZhang changed the title The warning diagnostics of the usage of std::intrinsics::copy_nonoverlapping in 1.86 is misleading The warning diagnostics of the usage of std::intrinsics::copy_nonoverlapping is misleading Apr 8, 2025
@smanilov
Copy link
Contributor

smanilov commented Apr 8, 2025

Looks like an easy fix, taking this on as a first issue.

@RalfJung
Copy link
Member

RalfJung commented Apr 8, 2025

@OscarTHZhang your code example does not compile. And it uses std::ptr so even if it compiled it would not show a deprecation warning. Could you fix the issue description? :)

@bors bors closed this as completed in 51bc376 Apr 9, 2025
rust-timer added a commit to rust-lang-ci/rust that referenced this issue Apr 9, 2025
Rollup merge of rust-lang#139526 - smanilov:issue-139505, r=RalfJung

Fix deprecation note for std::intrinsics

Also checked the rest of the mentions of std::mem in the changed file and they look good to me.

Fixes rust-lang#139505
github-actions bot pushed a commit to model-checking/verify-rust-std that referenced this issue Apr 19, 2025
Fix deprecation note for std::intrinsics

Also checked the rest of the mentions of std::mem in the changed file and they look good to me.

Fixes rust-lang#139505
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-diagnostics Area: Messages for errors, warnings, and lints T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants