Skip to content

Rustdoc JSON Produces dangling ID's when pub useing #[doc(hidden)] items. #106379

Closed
@aDotInTheVoid

Description

@aDotInTheVoid
#![feature(no_core)]
#![no_core]

mod repeat_n {
    #[doc(hidden)]
    pub struct RepeatN {}
}

pub use repeat_n::RepeatN;

Errors with

---- [rustdoc-json] src/test/rustdoc-json/reexport/pub_use_doc_hidden.rs stdout ----

error: jsondoclint failed!
status: exit status: 1
command: "/home/nixon/dev/rust/rust/build/x86_64-unknown-linux-gnu/stage0-tools-bin/jsondoclint" "/home/nixon/dev/rust/rust/build/x86_64-unknown-linux-gnu/test/rustdoc-json/reexport/pub_use_doc_hidden/pub_use_doc_hidden.json"
stdout: none
--- stderr -------------------------------
0:2:1571 not in index or paths, but refered to at '$.index["0:3"].inner.id'
Error: Errors validating json /home/nixon/dev/rust/rust/build/x86_64-unknown-linux-gnu/test/rustdoc-json/reexport/pub_use_doc_hidden/pub_use_doc_hidden.json
------------------------------------------

and produced

{
  "crate_version": null,
  "external_crates": {},
  "format_version": 23,
  "includes_private": false,
  "index": {
    "0:0:1572": {
      "crate_id": 0,
      "docs": null,
      "id": "0:0:1572",
      "inner": {"is_crate": true, "is_stripped": false, "items": ["0:3"]},
      "kind": "module",
      "links": {},
      "name": "pub_use_doc_hidden"
    },
    "0:3": {
      "crate_id": 0,
      "docs": null,
      "id": "0:3",
      "inner": {"glob": false, "id": "0:2:1571", "name": "RepeatN", "source": "repeat_n::RepeatN"},
      "kind": "import",
      "links": {},
      "name": null
    }
  },
  "paths": {"0:0:1572": {"crate_id": 0, "kind": "module", "path": ["pub_use_doc_hidden"]}},
  "root": "0:0:1572"
}

HTML gets this right and doesn't output anything:

image

Metadata

Metadata

Assignees

Labels

A-rustdoc-jsonArea: Rustdoc JSON backendT-rustdocRelevant to the rustdoc team, which will review and decide on the PR/issue.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions