-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
util: use <ptr>::addr instead of unsafe impl
#7725
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shall we use expose_provenance and std::ptr::with_exposed_provenance?
|
Hi @ADD-SP, it looks like that the |
|
The entire point of this file is to avoid using |
Darksonn
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks.
Motivation
I noticed that there are a couple of unsafe impl of the pointer's addr method in the code. Was wondering if we want to replace with
addrsince it's stable from v1.84.Solution
Replace
unsafe { std::mem::transmute(ptr) };with<ptr>::addrmethod.