rust-lang / rust-lang/rust

Debug and Display of `SocketAddrV6` omit `flowinfo`

Open
#148,546 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

A-fmt needs-triage T-libs
Dominant language
Rust
Stars
119k
Forks
16.1k
PR merge metrics
PR metrics pending

Description

As noted in a recent blog post by @sunshowers,

For most types in Rust, the Debug representation breaks out all the fields and their values. But for SocketAddrV6, the Debug implementation (quite reasonably) forwards to the Display implementation. So the flowinfo field is completely hidden, and the only way to look at it is through the flowinfo method.

This is also not the first time someone has been surprised by a lack of roundtrip serialization of this structure due to this field, see #77205.

It seems reasonable to preserve the Display implementation for this type, as it follows an RFC, but also to differentiate Debug to expose the flowinfo field.

If Debug were changed for this type, what should be the new string format?

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the Debug and Display implementations in core/net/socket_addr.rs, then read the flowinfo method documentation and the linked blog post. Review issue #77205 for prior context; done means reaching agreement on a new Debug string format that exposes flowinfo while preserving Display behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
networking
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.