rust-lang / rust-lang/rust

rustdoc: support searching cfg predicates

Open
#117,399 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

A-rustdoc-search C-feature-request F-doc_cfg T-rustdoc
Dominant language
Rust
Stars
119k
Forks
16.1k
PR merge metrics
PR metrics pending

Description

Currently, searching macros on https://docs.rs/tokio/1.33.0/tokio/ has 0 hits. It would be nice if it pulled up https://docs.rs/tokio/1.33.0/tokio/attr.main.html, which uses doc(cfg) to tell rustdoc that it's only available when the macros feature is enabled.

Note that this will make the search parser a little more complicated, since features don't have to be valid rust identifiers (in particular, it currently chokes on test-util):
Screenshot 2023-10-30 at 10 42 02 AM

@rustbot label F-doc_cfg

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 by reproducing the macros search on the linked Tokio docs.rs page and inspect rustdoc's search parser, especially how it handles doc(cfg) predicates. Done means searches find items gated by predicates such as macros and test-util, including feature names that contain hyphens.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
documentation, search
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
52/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.