Skip to content

rustdoc-json: Dangling ID when pub useing item from #[doc(hidden)] module #117718

Open
@aDotInTheVoid

Description

@aDotInTheVoid

With the following code:

#[doc(hidden)]
pub mod __secrets {
    pub struct Foo;
}

pub use __secrets::Foo;

It has a dangling ID:

---- [rustdoc-json] tests/rustdoc-json/reexport/pub_use_from_doc_hidden_mod.rs stdout ----

error: jsondoclint failed!
status: exit status: 1
command: "/home/gh-aDotInTheVoid/rust2/build/aarch64-unknown-linux-gnu/stage0-tools-bin/jsondoclint" "/home/gh-aDotInTheVoid/rust2/build/aarch64-unknown-linux-gnu/test/rustdoc-json/reexport/pub_use_from_doc_hidden_mod/pub_use_from_doc_hidden_mod.json"
stdout: none
--- stderr -------------------------------
0:4:1750 not in index or paths, but referred to at '$.index["0:6-0:4:1750"].inner.import.id'
Error: Errors validating json /home/gh-aDotInTheVoid/rust2/build/aarch64-unknown-linux-gnu/test/rustdoc-json/reexport/pub_use_from_doc_hidden_mod/pub_use_from_doc_hidden_mod.json
------------------------------------------

As it has the following json (redacted)

  "index": {
    "0:0:1751": {
      "inner": {"module": {"is_crate": true, "is_stripped": false, "items": ["0:6-0:4:1750"]}},
      "name": "pub_use_from_doc_hidden_mod"
    },
    "0:6-0:4:1750": {
      "inner": {"import": {"glob": false, "id": "0:4:1750", "name": "Foo", "source": "__secrets::Foo"}},
      "name": null
    },

In HTML, Foo is inlined to the crate root.

Version: 28acba3

Metadata

Metadata

Assignees

No one assigned

    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