rust-lang / rust-lang/rust

rustc docs are hard to navigate due to unusual entrypoints.

Open
#137,756 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

A-docs T-compiler
Dominant language
Rust
Stars
119k
Forks
16.1k
PR merge metrics
PR metrics pending

Description

This is a somewhat abstract issue that makes it harder to develop new "compiler plugins" like rustdoc and clippy if you are not already familiar with the compiler architecture.

Unlike most rust libraries, where objects are simply constructed, used, and dropped (following RAII), rustc's internal api very heavily relies on the "callback" pattern, which can cause issues for navigability.

The most obvious issue is simply unfamiliarity, but another issue that can arguably cause more friction is how this interacts with type-based search.

For most libraries, if you want to find the entrypoint of a types API, you can simply search for functions that return that type. However, if you try this in rustc, you are unlikely to find what you are looking for.

This can also be a problem in libraries that heavily use output parameters.

There are several ways this can be addressed, from simply documenting the main entrypoint of types, to complicated rustdoc search features where items can be given a semantic "signature alias" for type based search similar to how name aliases currently work.

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 reading the rustc_driver::run_compiler documentation and the linked rustc API search examples for TyCtxt and LintStore. Determine whether the work should document type entrypoints or improve rustdoc's type-based search, then define a concrete scope and verify that the relevant entrypoints become discoverable.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
compilers, documentation
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.