-
Notifications
You must be signed in to change notification settings - Fork 13.1k
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
Replace mem::zeroed with mem::MaybeUninit::uninit for large struct in Unix #136826
base: master
Are you sure you want to change the base?
Conversation
Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @thomcc (or someone else) some time within the next two weeks. Please see the contribution instructions for more information. Namely, in order to ensure the minimum review times lag, PR authors and assigned reviewers should ensure that the review label (
|
This comment has been minimized.
This comment has been minimized.
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.
I thought about this a bit. We probably can't use .assume_init()
as often as I thought since the C libraries neither guarantee that the structure can be moved, nor that it is fully initialized.
☔ The latest upstream changes (presumably #136954) made this pull request unmergeable. Please resolve the merge conflicts. |
… unix Signed-off-by: xizheyin <xizheyin@smail.nju.edu.cn>
Signed-off-by: xizheyin <xizheyin@smail.nju.edu.cn>
2dc051f
to
c1ecdf1
Compare
Signed-off-by: xizheyin <xizheyin@smail.nju.edu.cn>
That makes sense! I have removed |
Signed-off-by: xizheyin <xizheyin@smail.nju.edu.cn>
As discussion in #136737.
mem::zeroed()
withMaybeUninit::uninit()
forsockaddr_storage
inaccept()
andrecvfrom()
since these functions fill in the address structuremem::zeroed()
withMaybeUninit::uninit()
forpthread_attr_t
in thread-related functions sincepthread_attr_init()
initializes the structure