Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Rustdoc JSON: Duplicated ID's in lists #108236

Closed
aDotInTheVoid opened this issue Feb 19, 2023 · 3 comments
Closed

Rustdoc JSON: Duplicated ID's in lists #108236

aDotInTheVoid opened this issue Feb 19, 2023 · 3 comments
Labels
A-rustdoc-json Area: Rustdoc JSON backend T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.

Comments

@aDotInTheVoid
Copy link
Member

          Looking at the output (of `tests/rustdoc-json/reexport/same_name_different_types.rs`), for some reason it's duplicating ID's in the output:
  "index": {
    "0:0:1588": {
      "crate_id": 0,
      "docs": null,
      "id": "0:0:1588",
      "inner": {
        "is_crate": true,
        "is_stripped": false,
        "items": [
          "0:1:1582",
          "0:4-0:2:1584",
          "0:4-0:3:1584",
          "0:4-0:2:1584",
          "0:4-0:3:1584",
          "0:5-0:2:1584",
          "0:5-0:3:1584",
          "0:5-0:2:1584",
          "0:5-0:3:1584"
        ]
      },
      "kind": "module",
      "name": "same_name_different_types"
    },

I'm not really sure whats causing this, but idealy it wouldn't happen, although I'd be willing to merge as is, as long as an issue gets created to follow up.

(Also, jsondoclint should probably catch this)

Originally posted by @aDotInTheVoid in #107766 (comment)

CC: #108163

@shogohida
Copy link

Hi @aDotInTheVoid, can I work on this? I searched a bit for the source code but I don't know where to start yet...

@aDotInTheVoid
Copy link
Member Author

Your more than welcome to!

Convertion from clean to json for module's happens here, and it just passes of ID's coming from clean

ModuleItem(m) => {
ItemEnum::Module(Module { is_crate, items: ids(m.items, tcx), is_stripped: false })
}

Clean makes it's modules here

pub(crate) fn clean_doc_module<'tcx>(doc: &DocModule<'tcx>, cx: &mut DocContext<'tcx>) -> Item {

I'd start by adding debug! calls to see whats going on here. See the rustc dev guide for info on how the debug macros work for rustc. Feel free to ask questions on zulip if you have any

@aDotInTheVoid aDotInTheVoid added T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. A-rustdoc-json Area: Rustdoc JSON backend labels Feb 20, 2023
@GuillaumeGomez
Copy link
Member

It was fixed in #108349.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
A-rustdoc-json Area: Rustdoc JSON backend T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

3 participants