-
Notifications
You must be signed in to change notification settings - Fork 12.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Consider mangling ID's in rustdoc-json #91609
Comments
MD5 hashes should be deterministic, so non-determinism would only be introduced if we used a random number generator. |
I think MD5 hashes would be okay, though I would also support simply encoding the output in a less 'human readable' way. I'm okay with information being conveyed, if it's more obvious that the user isn't meant to access/rely on that information (think base64 or such) |
Found an example of someone parsing the ID format in the wild: |
CC @zjp-CN. If there's information that's only availible by parsing the (supposed-to-be) opaque identifiers, I'd love to hear that. Otherwise just be aware that you're relying on an implementation detail, and it's liable to break without notice. |
Hi, I did try to parse an id to learn about what it means in the testing, but haven't depended on it much in the app. There is missing information on parsing type: rustdoc_types::Impl doesn't tell if it's an auto impl, whereas an id starting with |
…Gomez rustdoc-json-types: Document `Id` Inspired by finding [someone looking into the internals of an id](rust-lang#91609 (comment)), I realized we only document the fact that these are opaque on [the rfc](https://rust-lang.github.io/rfcs/2963-rustdoc-json.html#id). r? `@GuillaumeGomez`
Rollup merge of rust-lang#125130 - aDotInTheVoid:id-docs, r=GuillaumeGomez rustdoc-json-types: Document `Id` Inspired by finding [someone looking into the internals of an id](rust-lang#91609 (comment)), I realized we only document the fact that these are opaque on [the rfc](https://rust-lang.github.io/rfcs/2963-rustdoc-json.html#id). r? `@GuillaumeGomez`
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.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, wherasa3aefbcbf31fa0bc12b9a73bc9d67976
(md5 hash) doesnt.Potential Drawbacks
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:
rust/src/librustdoc/json/mod.rs
Line 219 in 0fb1c37
rust/src/librustdoc/json/conversions.rs
Line 183 in 0fb1c37
I'm not sure if this is a good idea, and would love feedback
@rustbot modify labels: +C-discussion +A-rustdoc-json
The text was updated successfully, but these errors were encountered: