rust-lang / rust-lang/rust

Links in an exported proc-macro seem to always be broken without `cargo doc` warning about it?

Open
#138,575 1 comment 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

A-intra-doc-links T-rustdoc
Dominant language
Rust
Stars
119k
Forks
16.1k
PR merge metrics
PR metrics pending

Description

Take for example from https://docs.rs/awint/0.18.0/awint/index.html:

/// A concatenations of components macro, additionally using the source value to
/// construct an [InlAwi](awint_macro_internals::awint_core::InlAwi). See the
/// [crate documentation](crate) for more.
#[proc_macro]
pub fn inlawi(input: TokenStream) -> TokenStream {

The line [InlAwi](awint_macro_internals::awint_core::InlAwi) simply routes through a dependency of the proc-macro crate that is also plainly available to the awint crate it is reexported in. However, it is just broken. The line [crate documentation](crate) refers to the macro crate this macro is in, so that clicking on it goes to to proc-macros lib docs.

Apparently the [InlAwi](awint_macro_internals::awint_core::InlAwi) one has always been broken with "The requested resource does not exist", and the [crate documentation](crate) kind worked until sometime in the past few months without me noticing or cargo doc warning about it. I have published a workaround but it would be nice to fix this.

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

Reproduce the broken links from the proc-macro documentation example using cargo doc, comparing the InlAwi dependency path with the crate link and the generated docs on docs.rs. Trace how rustdoc resolves links originating in exported proc-macro documentation, then verify that valid links resolve correctly and broken links produce an appropriate cargo doc warning.

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
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.