rust-lang / rust-lang/rust

Rustdoc source links should link into expanded macros rather than to the macro invocation

Open
#146,007 1 comment 3 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

This is a followup from discussing PR #137229 on reddit.

Specially that PR added the ability to (unstably) expand macros in rustdoc source view. A great next step would be to have links from the docs to the source to go into the expanded macro. For example: the methods on u32 currently point to the macro invocation but could point into the expanded macro. This would make it a lot easier to see the source for the integer types and other types where it macros are used to define the impl blocks.

Cc @GuillaumeGomez

@rustbot label -C-bug

(Please fix the labels, I couldn't find a suitable template for this, so I selected rustdoc bug.)

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 reviewing PR #137229 and the rustdoc source-view macro-expansion behavior it introduced. Trace how links for u32 methods are generated and compare their current macro-invocation targets with expanded-macro locations. Done means documentation links enter the relevant expanded macro rather than the invocation.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.