Skip to content

Document net feature requirement of SockaddrIn and SockaddrIn6 - #2854

Merged
asomers merged 2 commits into
nix-rust:masterfrom
ump45nose:fix/2791-doc-cfg-net
Nov 14, 2026
Merged

asomers merged 2 commits into
nix-rust:masterfrom
ump45nose:fix/2791-doc-cfg-net

Conversation

@ump45nose

Copy link
Copy Markdown
Contributor

What does this PR do

Fixes #2791.

SockaddrIn, SockaddrIn6 and LinkAddr are defined in the private addr module and re-exported from nix::sys::socket under #[cfg(feature = "net")]. Because the re-export had no doc(cfg(...)), rustdoc only showed the socket requirement inherited from the parent module, so docs.rs said "Available on crate feature socket only" even though these types also need net.

This adds #[cfg_attr(docsrs, doc(cfg(feature = "net")))] to both pub use self::addr::{...} re-exports. With RUSTDOCFLAGS="--cfg docsrs" on nightly, the three struct pages now read "Available on crate features net and socket only." (before: "socket only"). I first tried putting the attribute on the struct definitions themselves, but rustdoc ignores it on inlined re-exports of items from a private module, so the re-export is the place that matters.

No functional change; cargo check --all-features and cargo check --features socket both pass, and cargo fmt --check is clean.

I used an AI assistant to help investigate and prepare this change; I reviewed the result and verified the rendered docs locally.

Checklist:

  • I have read CONTRIBUTING.md
  • I have written necessary tests and rustdoc comments
  • A change log has been added if this PR modifies nix's API

@asomers asomers left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM. But for future reference, a mere documentation fix does not require a changelog entry.

@asomers
asomers enabled auto-merge November 10, 2026 17:39
@asomers
asomers disabled auto-merge November 14, 2026 00:33
@asomers
asomers enabled auto-merge November 14, 2026 00:39
@asomers
asomers disabled auto-merge November 14, 2026 00:39
@asomers
asomers merged commit fe2fb40 into nix-rust:master Nov 14, 2026
16 of 20 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Doc of SockaddrIn mistakenly reports its feature gate

2 participants