-
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
Rename json::ItemEnum to ItemKind #80142
Comments
@rustbot claim |
Doing a simple LSP renaming command, got this error:
There is already a |
It's not clear to me why |
In the output we had items be "adjacently tagged" where they store the kind in a separate field instead of having the inner field be like an object with 1 key (the kind) and the inner ItemEnum as the value. Serde has an option to do that adjacent tagging automatically but it didn't work for ItemEnum for some reason iirc so instead we explicitly provide the kind alongside inner. It's not strictly necessary if you're using serde on both ends (it figures out which kind of ItemEnum it is based its contents when deserializing) but we wanted it to be easy to use other tools/languages to process the json where it'd be simpler to switch on a single field's value. Also looking at it now I remember that there's a couple of kinds of items (union, foreign function, and TyMethod) which reuse the ItemEnum representations from other kinds because they're identical but have separate ItemKinds to distinguish which one they were. It's doesn't have to be that way (you could just duplicate the types and give them different names like I think Clean does) buy it's something to watch out for if you're changing it. Oh and also ItemSummary needs the kind of the item but not the contents of it's ItemEnum so it may be best to keep ItemKind around actually now that I think about it. |
Hmm, ok. That makes sense, this sounds tricky to fix without changing the stable format. Thanks! |
This was renamed in
clean
in #79041, but I missedjson
.Originally posted by @jyn514 in #80119 (comment)
The text was updated successfully, but these errors were encountered: