Feature request: `#[doc(canonical)]`
Nobody has claimed this yet.
- Dominant language
- Markdown
- Stars
- 6.6k
- Forks
- 1.7k
- Avg merge
- 16h 14m
- Merged PRs (30d)
- 1
Description
I don't have time for a full write-up of this right now, so I'm just opening an issue so I have somewhere to point people when they open rustdoc issues.
Motivation:
- search items are duplicated (https://github.com/rust-lang/rust/issues/15723)
- rustdoc sometimes links to the original definition, even for facade crates that use inlining: https://github.com/rust-lang/rust/issues/22083
- ditto, but for intra-doc links: https://github.com/rust-lang/rust/issues/78467 (deemed to be a duplicate of the issue above)
- rustdoc sometimes links to a re-export, even when it is named differently than the link the user wrote: https://github.com/rust-lang/rust/issues/83976
doc(canonical) could tell rustdoc the 'one true path' the item should appear at.
Possible difficulties:
doc(canonical)is necessarily unique across all crates. rustdoc should give an error if it's duplicated.- rustdoc currently stores search-index.json per-crate. This will need a redesign if rustdoc only know to hide the item after the documentation has been generated and it goes onto the next crate
Unresolved questions:
- Does inlining still make sense with
doc(canonical)? Should all other usages just link to the canonical crate? How does this work if the canonical usage is in a reverse-dependency?
cc @camelid
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reading the linked rustdoc issues on duplicated search items, original-definition links, and re-export links. Then review the proposed doc(canonical) behavior, including duplicate detection and the per-crate search-index.json design. Done requires resolving the listed inlining and reverse-dependency questions and producing a complete design.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- documentation
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100