rust-lang / rust-lang/rust

Unwanted macro re-exports show up in documentation

Open
#145,577 16 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

A-macros A-rustdoc-search C-bug E-needs-mcve T-rustdoc T-rustdoc-frontend
Dominant language
Rust
Stars
119k
Forks
16.1k
PR merge metrics
PR metrics pending

Description

Code

prelude exported macros

Image

Reproduction Steps

  1. Open this https://doc.rust-lang.org/std/index.html?search=assert link

Alternatively

  1. Export macros directly from the prelude with #[doc(no_inline)]pub use such as here: https://github.com/rust-lang/rust/blob/425a9c0a0e365c0b8c6cfd00c2ded83a73bed9a0/library/std/src/prelude/v1.rs#L49

Expected Outcome

If #[doc(no_inline)] is used the re-exported item should not show up.

Actual Output

The re-exported item still shows up.

Version

This issue is not related to a specific browser, it happens with stable, nightly and dev rustdoc.

Additional Details

I noticed this issue while working on https://github.com/rust-lang/rust/pull/139493, which exacerbates the problem to all prelude macros. And there is a test that checks that typing "prinltn" into the search only returns 3 items and not 6 like it does with the change. Which suggests to me these re-exports are not desirable.

Before:

Image

After:

Image

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the prelude re-export in library/std/src/prelude/v1.rs and reproduce the behavior through the linked rustdoc search for assert. Read the rustdoc handling of #[doc(no_inline)] and the existing search test mentioned in the issue. Done means no-inline macro re-exports no longer appear in documentation search results while the existing test expectations remain correct.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
documentation
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.