Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Making net feature flag show in documentation for net::UdpSocket #6938

Merged
merged 1 commit into from
Oct 26, 2024

Conversation

jofas
Copy link
Contributor

@jofas jofas commented Oct 26, 2024

Fixes #6935. I nudged rustdoc to show the net feature on the re-export by cfg(inline)ing the documentation of UdpSocket. This works because net::udp::UdpSocket is already wrapped in a cfg_net!, which is seemingly stripped by rustdoc from the re-exported item.

Here are screenshots from my branch built with

RUSTDOCFLAGS="--cfg docsrs --cfg tokio_unstable" RUSTFLAGS="--cfg docsrs --cfg tokio_unstable" cargo +nightly doc --all-features

image

image

Comment on lines +49 to 50
#[doc(inline)]
pub use udp::UdpSocket;
Copy link
Contributor Author

@jofas jofas Oct 26, 2024

Choose a reason for hiding this comment

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

Alternatively one could wrap the re-export here in another cfg_net!, but I thought #[doc(inline)] would be less confusing:

Suggested change
#[doc(inline)]
pub use udp::UdpSocket;
cfg_net! {
pub use udp::UdpSocket;
}

Although, given that the net::udp module is already wrapped in a cfg_net! here, I believe we could also replace this cfg_net! (whose sole purpose is for the feature gate to show up in the docs in the first place, I reckon) with the one on the re-export I suggested above, in which case this would be the more straight-forward solution IMO.

@jofas jofas changed the title Making feature flag show in documentation for net::UdpSocket Making net feature flag show in documentation for net::UdpSocket Oct 26, 2024
@Darksonn Darksonn added A-tokio Area: The main tokio crate M-net Module: tokio/net labels Oct 26, 2024
Copy link
Contributor

@Darksonn Darksonn left a comment

Choose a reason for hiding this comment

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

Thanks!

@Darksonn Darksonn merged commit 946401c into tokio-rs:master Oct 26, 2024
86 checks passed
@jofas jofas deleted the docsrs-feature-flag-for-udp-socket branch October 26, 2024 12:54
kodiakhq bot pushed a commit to pdylanross/fatigue that referenced this pull request Nov 8, 2024
Bumps tokio from 1.41.0 to 1.41.1.

Release notes
Sourced from tokio's releases.

Tokio v1.41.1
1.41.1 (Nov 7th, 2024)
Fixed

metrics: fix bug with wrong number of buckets for the histogram (#6957)
net: display net requirement for net::UdpSocket in docs (#6938)
net: fix typo in TcpStream internal comment (#6944)

#6957: tokio-rs/tokio#6957
#6938: tokio-rs/tokio#6938
#6944: tokio-rs/tokio#6944



Commits

bb7ca75 chore: prepare Tokio v1.41.1 (#6959)
4a34b77 metrics: fix bug with wrong number of buckets for the histogram (#6957)
8897885 docs: fix mismatched backticks in CONTRIBUTING.md (#6951)
0dbdd19 ci: update cargo-check-external-types to 0.1.13 (#6949)
94e55c0 net: fix typo in TcpStream internal comment (#6944)
4468f27 metrics: fixed flaky worker_steal_count test (#6932)
070a825 metrics: removed race condition from global_queue_depth_multi_thread test (#6...
946401c net: display net requirement for net::UdpSocket in docs (#6938)
0c01fd2 ci: use patched version of cargo-check-external-types to fix CI failure (#6937)
ebe2416 ci: use cargo deny (#6931)
See full diff in compare view




Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


Dependabot commands and options

You can trigger Dependabot actions by commenting on this PR:

@dependabot rebase will rebase this PR
@dependabot recreate will recreate this PR, overwriting any edits that have been made to it
@dependabot merge will merge this PR after your CI passes on it
@dependabot squash and merge will squash and merge this PR after your CI passes on it
@dependabot cancel merge will cancel a previously requested merge and block automerging
@dependabot reopen will reopen this PR if it is closed
@dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
@dependabot show <dependency name> ignore conditions will show all of the ignore conditions of the specified dependency
@dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
@dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
@dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-tokio Area: The main tokio crate M-net Module: tokio/net
Projects
None yet
Development

Successfully merging this pull request may close these issues.

The required feature flag of UdpSocket is not shown like the other net components.
2 participants