Skip to content

Consider mangling ID's in rustdoc-json #91609

Closed
@aDotInTheVoid

Description

@aDotInTheVoid

Currently JSON ID's are (approximatly) the underling DefId's which means they are not realy opaque, despite what we've said in the RFC.

They happen to be the compiler internal DefId for that item, but in the JSON blob they should be treated as opaque as they aren't guaranteed to be stable across compiler invocations

The problem with this is that their is no obligation to treet the ID's as opaque (for a concreet example see scrabsha/scrabsha.github.io#2). If we want to garentee our ability to change the ID format, we should make it so that no one relies on the specific values of ID's by making them not cary information. Eg 0:0 lets the user know things, wheras a3aefbcbf31fa0bc12b9a73bc9d67976 (md5 hash) doesnt.

Potential Drawbacks

  • Non determinism
  • Harder to debug
  • Slower to build
  • Larger output

Which of these are actualy a problem, or just unfounded concerns I'm not sure:

If you want to change this: heres the places to look:

root: types::Id(String::from("0:0")),

ItemId::DefId(did) => Id(format!("{}", DisplayDefId(did))),

I'm not sure if this is a good idea, and would love feedback

@rustbot modify labels: +C-discussion +A-rustdoc-json

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-rustdoc-jsonArea: Rustdoc JSON backendC-discussionCategory: Discussion or questions that doesn't represent real issues.T-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