-
-
Notifications
You must be signed in to change notification settings - Fork 14.3k
Add "# Safety" and "# Examples" section in std::mem::uninitialized
#151033
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
base: main
Are you sure you want to change the base?
Conversation
Documentation of `std::mem::uninitialized` now have a # Safety section and a # Examples section.
|
Cc @rust-lang/libs for thoughts but I feel like we may not want this. There is never a time when I think that if somebody is interested in the actual semantics here, it's okay for them to read the source code. |
This comment has been minimized.
This comment has been minimized.
|
The job Click to see the possible cause of the failure (guessed by this bot) |
Agreed, we should let this deprecated function die. I'm especially wary that explicitly documenting safety conditions is really an API guarantee of sorts, while we really don't want anything that encourages its use. The current ambiguity serves as an additional warning flag not to use it. |
|
I agree with not having an example, but I think listing out safety preconditions is still good (I'd reword them a bit though to clearly discourage use) |
This PR improves documentation to
std::mem::uninitialized. While the function is deprecated, it currently lacks a formal # Safety section and clear examples on how to use it, even if it is almost always UB.