Skip to content

Remove SIZE generic param from DisplayBuffer in core::net#159372

Merged
rust-bors[bot] merged 1 commit into
rust-lang:mainfrom
Darksonn:core-net-displaybuffer
Jul 19, 2026
Merged

Remove SIZE generic param from DisplayBuffer in core::net#159372
rust-bors[bot] merged 1 commit into
rust-lang:mainfrom
Darksonn:core-net-displaybuffer

Conversation

@Darksonn

Copy link
Copy Markdown
Member

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.

@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Jul 16, 2026
@rustbot rustbot added the T-libs Relevant to the library team, which will review and decide on the PR/issue. label Jul 16, 2026
@rustbot

rustbot commented Jul 16, 2026

Copy link
Copy Markdown
Collaborator

r? @jhpratt

rustbot has assigned @jhpratt.
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, LawnGnome, Mark-Simulacrum, clarfonthey, jhpratt

@rust-log-analyzer

This comment has been minimized.

@Darksonn
Darksonn marked this pull request as draft July 16, 2026 09:19
@rustbot rustbot added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Jul 16, 2026
@Darksonn
Darksonn force-pushed the core-net-displaybuffer branch from 490cb5a to deb891a Compare July 16, 2026 10:16
@Darksonn
Darksonn marked this pull request as ready for review July 16, 2026 11:05
@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Jul 16, 2026
@jhpratt

jhpratt commented Jul 19, 2026

Copy link
Copy Markdown
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+

@rust-bors

rust-bors Bot commented Jul 19, 2026

Copy link
Copy Markdown
Contributor

📌 Commit deb891a has been approved by jhpratt

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 Jul 19, 2026
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`.
rust-bors Bot pushed a commit that referenced this pull request Jul 19, 2026
Rollup of 3 pull requests

Successful merges:

 - #159188 (Always generate private and hidden items in JSON docs of the stdlib)
 - #158546 (Move `std::io::BufRead` to `alloc::io`)
 - #159372 (Remove SIZE generic param from DisplayBuffer in core::net)
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`.
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-bors
rust-bors Bot merged commit 571fa58 into rust-lang:main Jul 19, 2026
13 checks passed
@rustbot rustbot added this to the 1.99.0 milestone Jul 19, 2026
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`.
@Darksonn
Darksonn deleted the core-net-displaybuffer branch July 20, 2026 09:15
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`)
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