-
Notifications
You must be signed in to change notification settings - Fork 13k
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
Rustdoc Json: structs and functions deserialize incorrect #82299
Labels
A-rustdoc-json
Area: Rustdoc JSON backend
C-bug
Category: This is a bug.
T-rustdoc
Relevant to the rustdoc team, which will review and decide on the PR/issue.
Comments
jyn514
added
A-rustdoc-json
Area: Rustdoc JSON backend
T-rustdoc
Relevant to the rustdoc team, which will review and decide on the PR/issue.
labels
Feb 19, 2021
hey @CraftSpider ;) are you interested in taking a look? |
Yes, I'll take a look at this |
@rustbot claim |
Dylan-DPC-zz
pushed a commit
to Dylan-DPC-zz/rust
that referenced
this issue
Mar 8, 2021
Remove Item::kind, use tagged enum. Rename variants to match Fixes rust-lang#82299, by making the ItemEnum tagged. Doesn't remove ItemKind as it's still used in other places. r? `@jyn514` `@rustbot` label: +A-rustdoc-json +T-rustdoc
Dylan-DPC-zz
pushed a commit
to Dylan-DPC-zz/rust
that referenced
this issue
Mar 8, 2021
Remove Item::kind, use tagged enum. Rename variants to match Fixes rust-lang#82299, by making the ItemEnum tagged. Doesn't remove ItemKind as it's still used in other places. r? ``@jyn514`` ``@rustbot`` label: +A-rustdoc-json +T-rustdoc
Dylan-DPC-zz
pushed a commit
to Dylan-DPC-zz/rust
that referenced
this issue
Mar 8, 2021
Remove Item::kind, use tagged enum. Rename variants to match Fixes rust-lang#82299, by making the ItemEnum tagged. Doesn't remove ItemKind as it's still used in other places. r? ```@jyn514``` ```@rustbot``` label: +A-rustdoc-json +T-rustdoc
Dylan-DPC-zz
pushed a commit
to Dylan-DPC-zz/rust
that referenced
this issue
Mar 8, 2021
Remove Item::kind, use tagged enum. Rename variants to match Fixes rust-lang#82299, by making the ItemEnum tagged. Doesn't remove ItemKind as it's still used in other places. r? ````@jyn514```` ````@rustbot```` label: +A-rustdoc-json +T-rustdoc
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
A-rustdoc-json
Area: Rustdoc JSON backend
C-bug
Category: This is a bug.
T-rustdoc
Relevant to the rustdoc team, which will review and decide on the PR/issue.
I tried this code:
Running
rustdoc
on this this happily produces the following json which I would judge to be correct.However, deserializing this with the types defined in
src/rustdoc-json-types/lib.rs
leads to the incoherent representation:This happens because the
ItemEnum
is an untagged enum, theUnionItem
variant appears before theStructItem
variant and thestruct Union
has a subset of the fields ofstruct Struct
, therefore it matches first. The same issue happens withFunctionItem
/Function
andMethodItem
/Method
.It could be fixed by reordering the variants but that's quite brittle and non-obvious.
Meta
rustc --version --verbose
:cc: @jyn514
The text was updated successfully, but these errors were encountered: