Skip to content

core: clarify MaybeUninit::assume_init UB for uninitialized integers#153253

Open
laddery-a wants to merge 2 commits intorust-lang:mainfrom
laddery-a:claw/maybeuninit-docs-uninit-pod
Open

core: clarify MaybeUninit::assume_init UB for uninitialized integers#153253
laddery-a wants to merge 2 commits intorust-lang:mainfrom
laddery-a:claw/maybeuninit-docs-uninit-pod

Conversation

@laddery-a
Copy link

@laddery-a laddery-a commented Mar 1, 2026

Fixes #150689.

This clarifies in the MaybeUninit::assume_init safety docs that calling assume_init on uninitialized memory is immediate UB even when T is an integer / POD type, and adds a small incorrect-usage example using u8.

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-libs Relevant to the library team, which will review and decide on the PR/issue. labels Mar 1, 2026
@rustbot
Copy link
Collaborator

rustbot commented Mar 1, 2026

r? @scottmcm

rustbot has assigned @scottmcm.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

Why was this reviewer chosen?

The reviewer was selected based on:

  • Owners of files modified in this PR: @scottmcm, libs
  • @scottmcm, libs expanded to 8 candidates
  • Random selection from Mark-Simulacrum, joboet, scottmcm

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

Labels

S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. 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.

Docs for MaybeUninit::assume_init should indicate that reading uninit POD isn't sound

3 participants