rust-lang / rust-lang/rust

`rustdoc::broken_intra_doc_links` won't catch obvious invalid links

Open
#130,126 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

I tried this code:

Lint rustdoc::broken_intra_doc_links warns by default, but it cannot catch obvious invalid links in the fanotify module of the Nix crate.

See the section Steps to reproduce for how to reproduce this behavior.

I expected to see this happen: explanation

Invalid links will be caught

Instead, this happened: explanation

They are not caught

Meta

rustc --version --verbose:

$ rustc --version --verbose
rustc 1.80.1 (3f5fd8dd4 2024-08-06)
binary: rustc
commit-hash: 3f5fd8dd41153bc5fdca9427e9e05be2c767ba23
commit-date: 2024-08-06
host: aarch64-apple-darwin
release: 1.80.1
LLVM version: 18.1.7
Backtrace

no backtrace

Context:

Today I found some invalid links in the Nix crate, and fixed them in this PR https://github.com/nix-rust/nix/pull/2493, then I am surprised that they weren't caught by this lint

Steps to reproduce
$ git clone https://github.com/nix-rust/nix.git
$ cd nix
$ git reset --hard 82301035e4af3ca7903ba1abaf1955b2de61c8d5 # This is a commit where the invalid links exist
$ cargo doc --target x86_64-unknown-linux-gnu --all-features

    Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.03s
   Generated /Users/steve/Documents/workspace/test/target/x86_64-unknown-linux-gnu/doc/nix/index.html
$ echo $?
0

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 report from the Nix commit 82301035e4af3ca7903ba1abaf1955b2de61c8d5 with cargo doc --target x86_64-unknown-linux-gnu --all-features, focusing on rustdoc::broken_intra_doc_links and the invalid links in the fanotify module. Done means those invalid links are detected by the lint rather than allowing documentation generation to exit successfully.

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.