Remove SIZE generic param from DisplayBuffer in core::net#159372
Merged
Conversation
Collaborator
|
r? @jhpratt rustbot has assigned @jhpratt. Use Why was this reviewer chosen?The reviewer was selected based on:
|
This comment has been minimized.
This comment has been minimized.
Darksonn
marked this pull request as draft
July 16, 2026 09:19
Darksonn
force-pushed
the
core-net-displaybuffer
branch
from
July 16, 2026 10:16
490cb5a to
deb891a
Compare
20 tasks
Darksonn
marked this pull request as ready for review
July 16, 2026 11:05
Member
|
Simple enough; I've done something similar in my own code so oddly enough I'm familiar with this pattern. The assembly may be slightly different due to the possibility of bounds checks, but it's already in the slow path so I don't see that as an issue. @bors r+ |
Contributor
jhpratt
added a commit
to jhpratt/rust
that referenced
this pull request
Jul 19, 2026
…=jhpratt
Remove SIZE generic param from DisplayBuffer in core::net
These symbols were observed on the surface of `core.o`:
```
<core::net::display_buffer::DisplayBuffer<15> as core::fmt::Write>::write_char
<core::net::display_buffer::DisplayBuffer<15> as core::fmt::Write>::write_fmt
<core::net::display_buffer::DisplayBuffer<15> as core::fmt::Write>::write_str
<core::net::display_buffer::DisplayBuffer<21> as core::fmt::Write>::write_char
<core::net::display_buffer::DisplayBuffer<21> as core::fmt::Write>::write_fmt
<core::net::display_buffer::DisplayBuffer<21> as core::fmt::Write>::write_str
<core::net::display_buffer::DisplayBuffer<39> as core::fmt::Write>::write_char
<core::net::display_buffer::DisplayBuffer<39> as core::fmt::Write>::write_fmt
<core::net::display_buffer::DisplayBuffer<39> as core::fmt::Write>::write_str
<core::net::display_buffer::DisplayBuffer<58> as core::fmt::Write>::write_char
<core::net::display_buffer::DisplayBuffer<58> as core::fmt::Write>::write_fmt
<core::net::display_buffer::DisplayBuffer<58> as core::fmt::Write>::write_str
```
There's no reason to instantiate four different copies of this super simple logic, so remove the size parameter allowing each case to call into the same shared machine code.
It's not possible to inline these symbols into the `{SocketAddrV*,Ipv*Addr}::fmt` methods because `core::fmt::write` constructs a `&mut dyn fmt::Write` to the `DisplayBuffer`.
jhpratt
added a commit
to jhpratt/rust
that referenced
this pull request
Jul 19, 2026
…=jhpratt
Remove SIZE generic param from DisplayBuffer in core::net
These symbols were observed on the surface of `core.o`:
```
<core::net::display_buffer::DisplayBuffer<15> as core::fmt::Write>::write_char
<core::net::display_buffer::DisplayBuffer<15> as core::fmt::Write>::write_fmt
<core::net::display_buffer::DisplayBuffer<15> as core::fmt::Write>::write_str
<core::net::display_buffer::DisplayBuffer<21> as core::fmt::Write>::write_char
<core::net::display_buffer::DisplayBuffer<21> as core::fmt::Write>::write_fmt
<core::net::display_buffer::DisplayBuffer<21> as core::fmt::Write>::write_str
<core::net::display_buffer::DisplayBuffer<39> as core::fmt::Write>::write_char
<core::net::display_buffer::DisplayBuffer<39> as core::fmt::Write>::write_fmt
<core::net::display_buffer::DisplayBuffer<39> as core::fmt::Write>::write_str
<core::net::display_buffer::DisplayBuffer<58> as core::fmt::Write>::write_char
<core::net::display_buffer::DisplayBuffer<58> as core::fmt::Write>::write_fmt
<core::net::display_buffer::DisplayBuffer<58> as core::fmt::Write>::write_str
```
There's no reason to instantiate four different copies of this super simple logic, so remove the size parameter allowing each case to call into the same shared machine code.
It's not possible to inline these symbols into the `{SocketAddrV*,Ipv*Addr}::fmt` methods because `core::fmt::write` constructs a `&mut dyn fmt::Write` to the `DisplayBuffer`.
This was referenced Jul 19, 2026
rust-bors Bot
pushed a commit
that referenced
this pull request
Jul 19, 2026
Rollup of 5 pull requests Successful merges: - #158546 (Move `std::io::BufRead` to `alloc::io`) - #159372 (Remove SIZE generic param from DisplayBuffer in core::net) - #159548 (miri subtree update) - #159508 (Some cleanup in `rustc_attr_parsing`) - #159539 ([rustc_abi] Customize `Debug` for `Primitive` and `Scalar`)
rust-timer
added a commit
that referenced
this pull request
Jul 19, 2026
Rollup merge of #159372 - Darksonn:core-net-displaybuffer, r=jhpratt Remove SIZE generic param from DisplayBuffer in core::net These symbols were observed on the surface of `core.o`: ``` <core::net::display_buffer::DisplayBuffer<15> as core::fmt::Write>::write_char <core::net::display_buffer::DisplayBuffer<15> as core::fmt::Write>::write_fmt <core::net::display_buffer::DisplayBuffer<15> as core::fmt::Write>::write_str <core::net::display_buffer::DisplayBuffer<21> as core::fmt::Write>::write_char <core::net::display_buffer::DisplayBuffer<21> as core::fmt::Write>::write_fmt <core::net::display_buffer::DisplayBuffer<21> as core::fmt::Write>::write_str <core::net::display_buffer::DisplayBuffer<39> as core::fmt::Write>::write_char <core::net::display_buffer::DisplayBuffer<39> as core::fmt::Write>::write_fmt <core::net::display_buffer::DisplayBuffer<39> as core::fmt::Write>::write_str <core::net::display_buffer::DisplayBuffer<58> as core::fmt::Write>::write_char <core::net::display_buffer::DisplayBuffer<58> as core::fmt::Write>::write_fmt <core::net::display_buffer::DisplayBuffer<58> as core::fmt::Write>::write_str ``` There's no reason to instantiate four different copies of this super simple logic, so remove the size parameter allowing each case to call into the same shared machine code. It's not possible to inline these symbols into the `{SocketAddrV*,Ipv*Addr}::fmt` methods because `core::fmt::write` constructs a `&mut dyn fmt::Write` to the `DisplayBuffer`.
pull Bot
pushed a commit
to xtqqczze/rust-lang-miri
that referenced
this pull request
Jul 22, 2026
Rollup of 5 pull requests Successful merges: - rust-lang/rust#158546 (Move `std::io::BufRead` to `alloc::io`) - rust-lang/rust#159372 (Remove SIZE generic param from DisplayBuffer in core::net) - rust-lang/rust#159548 (miri subtree update) - rust-lang/rust#159508 (Some cleanup in `rustc_attr_parsing`) - rust-lang/rust#159539 ([rustc_abi] Customize `Debug` for `Primitive` and `Scalar`)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
These symbols were observed on the surface of
core.o:There's no reason to instantiate four different copies of this super simple logic, so remove the size parameter allowing each case to call into the same shared machine code.
It's not possible to inline these symbols into the
{SocketAddrV*,Ipv*Addr}::fmtmethods becausecore::fmt::writeconstructs a&mut dyn fmt::Writeto theDisplayBuffer.