Skip to content

chore: Do not show "Available on non-loom only." doc label#7977

Merged
martin-g merged 6 commits intotokio-rs:masterfrom
martin-g:7976-suppress-loom-label-in-docs
Mar 18, 2026
Merged

chore: Do not show "Available on non-loom only." doc label#7977
martin-g merged 6 commits intotokio-rs:masterfrom
martin-g:7976-suppress-loom-label-in-docs

Conversation

@martin-g
Copy link
Copy Markdown
Member

Motivation

Do not show "Available on non-loom only." doc label

Closes #7976

Solution

Uses the unstable #[doc(cfg()]. rust-lang/rust#43781

@Darksonn Darksonn added T-docs Topic: documentation A-tokio Area: The main tokio crate M-runtime Module: tokio/runtime labels Mar 18, 2026
@martin-g martin-g marked this pull request as draft March 18, 2026 09:52
@martin-g martin-g marked this pull request as ready for review March 18, 2026 10:03
@Darksonn
Copy link
Copy Markdown
Member

This worked, but the front page now shows it instead:

image

@martin-g martin-g marked this pull request as draft March 18, 2026 12:00
@martin-g
Copy link
Copy Markdown
Member Author

What do you think about replacing #[cfg(not(loom))] with #[cfg_attr(not(docsrs), cfg(not(loom)))] ?

tokio/src/lib.rs Outdated
))]
// loom is an internal implementation detail.
// Do not show "Available on non-loom only" label
#![cfg_attr(docsrs, doc(cfg(not(loom))))]
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.

Does this work?

Suggested change
#![cfg_attr(docsrs, doc(cfg(not(loom))))]
#![cfg_attr(docsrs, doc(cfg(hide(loom))))]

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

$ RUSTDOCFLAGS="--cfg docsrs --cfg tokio_unstable" cargo +nightly doc --lib --no-deps --document-private-items --features full --open -p tokio
    Blocking waiting for file lock on artifact directory
 Documenting tokio v1.50.0 (/home/mgrigorov/git/rust/tokio/tokio)
error[E0537]: invalid predicate `hide`
  --> tokio/src/lib.rs:20:29
   |
20 | #![cfg_attr(docsrs, doc(cfg(hide(loom))))]
   |                             ^^^^^^^^^^

For more information about this error, try `rustc --explain E0537`.

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.

If not, what about doc(auto_cfg(hide(loom)))

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.

I was looking at the tests in rust-lang/rust#153964 as a reference.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

doc(auto_cfg(hide(loom))) works!

@Darksonn
Copy link
Copy Markdown
Member

For convenience, docs preview link:

https://deploy-preview-7977--tokio-rs.netlify.app/tokio/

@Darksonn
Copy link
Copy Markdown
Member

Feel free to merge once this passes CI.

@martin-g martin-g marked this pull request as ready for review March 18, 2026 13:03
@martin-g martin-g merged commit 66c7865 into tokio-rs:master Mar 18, 2026
89 checks passed
@martin-g martin-g deleted the 7976-suppress-loom-label-in-docs branch March 18, 2026 13:14
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-runtime Module: tokio/runtime T-docs Topic: documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

"Available on non-loom" only in docs

3 participants