-
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
runtime: fix stability feature flags for docs #6909
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As a sidenote, I wonder if it would be possible to use https://doc.rust-lang.org/rustdoc/unstable-features.html#doc_auto_cfg-automatically-generate-doccfg instead of manually adding all these attributes? Are there places where you would not want the specified items to be documented with their required feature flags? I did see a couple of places where there's a different implementation depending on which flag is in use, perhaps that's the problem here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unfortunately auto cfg docs only works for features and not for --cfg
flags like tokio_unstable
.
tokio/src/runtime/builder.rs
Outdated
@@ -728,6 +728,7 @@ impl Builder { | |||
/// # } | |||
/// ``` | |||
#[cfg(all(not(loom), tokio_unstable))] | |||
#[cfg_attr(docsrs, doc(cfg(all(not(loom), tokio_unstable))))] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Loom should not be mentioned in docs.
#[cfg_attr(docsrs, doc(cfg(all(not(loom), tokio_unstable))))] | |
#[cfg_attr(docsrs, doc(cfg(tokio_unstable)))] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please fix all instances of this issue. Marking unresolved.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done in 7aaac8a4
Co-authored-by: Alice Ryhl <[email protected]>
#[cfg(all(not(loom), tokio_unstable))] | ||
#[cfg_attr(docsrs, doc(cfg(tokio_unstable)))] | ||
pub fn on_task_spawn<F>(&mut self, f: F) -> &mut Self |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please also add the docs blurb about this being unstable.
/// **Note**: This is an [unstable API][unstable]. The public API of this type
/// may break in 1.x releases. See [the documentation on unstable
/// features][unstable] for details.
///
/// [unstable]: crate#unstable-features
I would add it to on_task_spawn
, on_task_terminate
, and TaskMeta
. Probably not to MultiThreadAlt
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done in 6b438c15
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you.
Motivation
Fixes: #6907
Solution
Adds doc attribute noting the tokio_unstable requirements for various items