rust-lang / rust-lang/rust

rustdoc-json: items may reference non-existent IDs.

Open
#153,578 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

A-rustdoc-json A-visibility C-bug T-rustdoc
Dominant language
Rust
Stars
119k
Forks
16.1k
PR merge metrics
PR metrics pending

Description

To reproduce, get rust-src from 2026-03-05, run cargo rustdoc -p core --output-format json -Z unstable-options -- --document-private-items.

In the generated json file, any reference to ParseFloatError has a non-existent ID.

For example, this use dec2flt::ParseFloatError statement in core/src/num/mod.rs:

{
"7473": {
      "id": 7473,
      "crate_id": 0,
      "name": null,
      "span": {
        "filename": "core/src/num/mod.rs",
        "begin": [
          62,
          1
        ],
        "end": [
          62,
          34
        ]
      },
      "visibility": "public",
      "docs": null,
      "links": {},
      "attrs": [
        {
          "other": "#[attr = CfgTrace([Not(NameValue { name: \"no_fp_fmt_parse\", value: None, span: core/src/num/mod.rs:61:11: 61:26 (#0) }, core/src/num/mod.rs:61:10: 61:27 (#0))])]"
        },
        {
          "other": "#[attr = Stability {stability: Stability {level: Stable {since: Version(RustcVersion { major: 1, minor: 0, patch: 0 })},\nfeature: \"rust1\"}}]"
        }
      ],
      "deprecation": null,
      "inner": {
        "use": {
          "source": "dec2flt::ParseFloatError",
          "name": "ParseFloatError",
          "id": 634,
          "is_glob": false
        }
      }
    }
}

There is no Item or ItemSummary with Id 634.

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 issue with the listed rust-src revision and cargo rustdoc command, then inspect the generated JSON entry in core/src/num/mod.rs for ParseFloatError and ID 634. Trace how rustdoc JSON resolves referenced items and add a regression check ensuring every referenced ID has a corresponding Item or ItemSummary.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.