Skip to content

io: Use NonNull for all Custom API related to Box, update documentation for Custom - #161020

Open
tgross35 wants to merge 2 commits into
rust-lang:mainfrom
tgross35:io-error-updates
Open

io: Use NonNull for all Custom API related to Box, update documentation for Custom#161020
tgross35 wants to merge 2 commits into
rust-lang:mainfrom
tgross35:io-error-updates

Conversation

@tgross35

Copy link
Copy Markdown
Contributor

Use NonNull a few more places to avoid the need to convert to and from *mut T. Also document the invariants for Custom.

cc @bushrat011899

`*mut T` is used in a few places where we have a `NonNull`. Use
`NonNull` everywhere to save a few conversions.
@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 Aug 13, 2026
@rustbot

rustbot commented Aug 13, 2026

Copy link
Copy Markdown
Collaborator

r? @clarfonthey

rustbot has assigned @clarfonthey.
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: libs
  • libs expanded to 12 candidates
  • Random selection from JohnTitor, Mark-Simulacrum, clarfonthey, nia-e

@bushrat011899 bushrat011899 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! This makes sense to me and definitely moves towards a more sane implementation. One minor nit around import paths.

View changes since this review

Comment thread library/core/src/io/error.rs Outdated
Add comments about what fields do and turn cross-method safety into
easier to follow invariants.
@clarfonthey

Copy link
Copy Markdown
Contributor

Seems reasonable to me, and always appreciate improving docs on private items. Thank you!

@bors r+ rollup

@rust-bors

rust-bors Bot commented Aug 13, 2026

Copy link
Copy Markdown
Contributor

📌 Commit 57b5019 has been approved by clarfonthey

It is now in the queue for this repository.

@rust-bors rust-bors Bot added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Aug 13, 2026
jhpratt added a commit to jhpratt/rust that referenced this pull request Aug 13, 2026
…onthey

io: Use `NonNull` for all `Custom` API related to `Box`, update documentation for `Custom`

Use `NonNull` a few more places to avoid the need to convert to and from `*mut T`. Also document the invariants for `Custom`.
rust-bors Bot pushed a commit that referenced this pull request Aug 13, 2026
Rollup of 14 pull requests

Successful merges:

 - #158918 (x86_64-win: Enable f128 on LLVM 23+)
 - #160288 (rustdoc: use anonymous constant for primitives/keywords/attribute docs)
 - #160440 (Couple of misc improvements to the unwind infrastructure)
 - #160441 (PowerPC inline ASM: Fix scalar floats being in the wrong vector lane on little endian)
 - #160896 (tidy: Update Python version requirements to 3.11)
 - #160972 (std: map ERROR_NEGATIVE_SEEK to ErrorKind::InvalidInput on Windows)
 - #161040 (Optimize CStr backing slice bounds checks)
 - #158885 (Add `core::num::Complex`)
 - #160928 (check `mut`-restriction when tuple constructor is used as a value)
 - #161002 (disallow `#[cold]` on `extern "custom"` functions)
 - #161016 (Fix invalid suggestion from try unlabled block)
 - #161020 (io: Use `NonNull` for all `Custom` API related to `Box`, update documentation for `Custom`)
 - #161044 (rustc-dev-guide subtree update)
 - #161046 (Enable unrolling feature of bors)
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Aug 13, 2026
…onthey

io: Use `NonNull` for all `Custom` API related to `Box`, update documentation for `Custom`

Use `NonNull` a few more places to avoid the need to convert to and from `*mut T`. Also document the invariants for `Custom`.
rust-bors Bot pushed a commit that referenced this pull request Aug 13, 2026
…uwer

Rollup of 17 pull requests

Successful merges:

 - #161045 (stdarch subtree update)
 - #157428 (allocator: refactor for stabilisation)
 - #158918 (x86_64-win: Enable f128 on LLVM 23+)
 - #160288 (rustdoc: use anonymous constant for primitives/keywords/attribute docs)
 - #160440 (Couple of misc improvements to the unwind infrastructure)
 - #160441 (PowerPC inline ASM: Fix scalar floats being in the wrong vector lane on little endian)
 - #160896 (tidy: Update Python version requirements to 3.11)
 - #160972 (std: map ERROR_NEGATIVE_SEEK to ErrorKind::InvalidInput on Windows)
 - #161040 (Optimize CStr backing slice bounds checks)
 - #160928 (check `mut`-restriction when tuple constructor is used as a value)
 - #160969 (give layout errors from `size_of_val` and `align_of_val` a span)
 - #161002 (disallow `#[cold]` on `extern "custom"` functions)
 - #161016 (Fix invalid suggestion from try unlabled block)
 - #161020 (io: Use `NonNull` for all `Custom` API related to `Box`, update documentation for `Custom`)
 - #161044 (rustc-dev-guide subtree update)
 - #161046 (Enable unrolling feature of bors)
 - #161054 (rustdoc: Fix link title attribute value when field of enum variants)
jhpratt added a commit to jhpratt/rust that referenced this pull request Aug 13, 2026
…onthey

io: Use `NonNull` for all `Custom` API related to `Box`, update documentation for `Custom`

Use `NonNull` a few more places to avoid the need to convert to and from `*mut T`. Also document the invariants for `Custom`.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

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.

4 participants