Skip to content

Replace mem::zeroed with mem::MaybeUninit::uninit for large struct in Unix#136826

Merged
bors merged 4 commits into
rust-lang:masterfrom
xizheyin:issue-136737
Feb 23, 2025
Merged

Replace mem::zeroed with mem::MaybeUninit::uninit for large struct in Unix#136826
bors merged 4 commits into
rust-lang:masterfrom
xizheyin:issue-136737

Conversation

@xizheyin
Copy link
Copy Markdown
Member

As discussion in #136737.

  • Replace mem::zeroed() with MaybeUninit::uninit() for sockaddr_storage in accept() and recvfrom() since these functions fill in the address structure
  • Replace mem::zeroed() with MaybeUninit::uninit() for pthread_attr_t in thread-related functions since pthread_attr_init() initializes the structure
  • Add references to man pages to document this behavior

Loading
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

O-unix Operating system: Unix-like S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-libs Relevant to the library team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants