Skip to content

use IPV6 loopback and documentation address in documentation over V4 by default - #161879

Open
2ndDerivative wants to merge 8 commits into
rust-lang:mainfrom
2ndDerivative:ipv6_documentation_default
Open

use IPV6 loopback and documentation address in documentation over V4 by default#161879
2ndDerivative wants to merge 8 commits into
rust-lang:mainfrom
2ndDerivative:ipv6_documentation_default

Conversation

@2ndDerivative

@2ndDerivative 2ndDerivative commented Aug 27, 2026

Copy link
Copy Markdown
Contributor

This defaults all documentation unrelated to specific IP versions to the current IPv6.

Related to issue #161832

I didn't touch any tests, as I'm pretty new and don't know much about the test infrastructure, but maybe it should be considered to run all the tests via the v6 loopback by default too.

Feel free to discuss and / or critique!

My submission towards rust-lang#161832

I didn't touch any tests or anything that actually gets run for now, but if this is realistic Rust should probably default to using [::1] loopback for the std tests too.
@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 27, 2026
@rustbot

rustbot commented Aug 27, 2026

Copy link
Copy Markdown
Collaborator

Thanks for the pull request, and welcome! The Rust Project has assigned @joboet (or someone else) to review your changes, you should hear from them (or someone else) within the next two weeks.

Please see the contribution instructions and our LLM policy for more information.

Why was this reviewer chosen?

The reviewer was selected based on:

  • Owners of files modified in this PR: @ChrisDenton, libs
  • @ChrisDenton, libs expanded to 13 candidates
  • Random selection from 6 candidates

@rustbot

rustbot commented Aug 27, 2026

Copy link
Copy Markdown
Collaborator

⚠️ Warning ⚠️

  • There are issue links (such as #123) in the commit messages of the following commits.
    Please move them to the PR description, to avoid spamming the issues with references to the commit, and so this bot can automatically canonicalize them to avoid issues with subtree.

@2ndDerivative 2ndDerivative changed the title use IPV6 loopback and documentation address in over V4 by default use IPV6 loopback and documentation address in documentation over V4 by default Aug 27, 2026
@rust-log-analyzer

This comment has been minimized.

Comment thread library/std/src/net/socket_addr.rs
@joboet

joboet commented Aug 30, 2026

Copy link
Copy Markdown
Member

I really don't have an opinion here, networking isn't my domain (pun intended).

@rustbot reroll

@rustbot rustbot assigned ChrisDenton and unassigned joboet Aug 30, 2026
@ChrisDenton

Copy link
Copy Markdown
Member

I admit I'm struggling to feel strongly about this either way. This does feel like a policy decision though:

I think the Rust docs could be doing their part to normalize using [IPv6].

@rust-lang/libs does anybody have thoughts on this?

/// use std::net::TcpStream;
///
/// let mut stream = TcpStream::connect("127.0.0.1:34254").unwrap();
/// let mut stream = TcpStream::connect("[::1]:34254").unwrap();

@NobodyXu NobodyXu Aug 30, 2026

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.

How about keeping both versions side-by-side?

Many, for example me, aren't familiar with IPv6, having both will help me read the docs while bridge me into ipv6

Suggested change
/// let mut stream = TcpStream::connect("[::1]:34254").unwrap();
/// let mut stream = TcpStream::connect("127.0.0.1:34254").unwrap(); // ipv4
/// let mut stream = TcpStream::connect("[::1]:34254").unwrap(); // ipv6

View changes since the review

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

would this be for every TcpStream::connect in the docs?
It's just the localhost address everywhere, but if the duplication is not a problem, sure! 👍🏻

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.

I like this idea, honestly. Since examples are also doctests, it makes sense to have "coverage" for these, I think.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

would I just redeclare the stream/whateverit'snamed variable on every doctest or how would we do that? :-)

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.

I mean, it would depend on the test, but you're welcome to use your own judgement. It would be fine to define both but only "use" the v6 one imo

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

considering that adding both versions to every site where I changed it would be a lot of clutter, I suggest my newest change, which is adding an ipv4_x declaration to UdpSocket, TcpListener and TcpStream struct examples (meaning they show up on the top of the page in rustdoc)

@clarfonthey

Copy link
Copy Markdown
Contributor

I can take this over since I did the previous one. r? clarfonthey

@rustbot rustbot assigned clarfonthey and unassigned ChrisDenton Aug 30, 2026
@rust-log-analyzer

This comment has been minimized.

@tgross35

Copy link
Copy Markdown
Member

I think the Rust docs could be doing their part to normalize using [IPv6].

@rust-lang/libs does anybody have thoughts on this?

Personally I'm -0.75 – users are way more likely to encounter IPv4 at the time being, and likely for the foreseeable future. I don't think I've ever seen documentation anywhere use [::1] rather than 127.0.0.1 when both are an option.

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.

9 participants