Skip to content
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: Document Stripped Fields for enum varients #100587

Closed
aDotInTheVoid opened this issue Aug 15, 2022 · 1 comment · Fixed by #101462
Closed

Rustdoc-Json: Document Stripped Fields for enum varients #100587

aDotInTheVoid opened this issue Aug 15, 2022 · 1 comment · Fixed by #101462
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

aDotInTheVoid commented Aug 15, 2022

At some point their should also be a has_striped_fields for Variant, and probably a way to tell what position each of the non stripped items are, as currently each of these 3 variants are documented with the same inner.

enum Foo {
  A(i32)
  B(i32, #[doc(hidden)] i32)
  C(#[doc(hidden)] i32, i32)
}

but HTML gets a good representation:

The solution is probably to do what we do for structs, and store the StructType, and a Vec<Id>, such that each field of a varient gets an Item to hold the name. We also should have a num_fields, as even in that schema, you can't tell the difference between

enum Foo {
  A(#[doc(hidden)] i32),
  B(#[doc(hidden)]i32, #[doc(hidden)]i32)
}

This also effects struct AFAIKT.

I don't think this needs to be done now. I'll file an issue for it.

Originally posted by @aDotInTheVoid in #100582 (comment)

@rustbot modify labels: +A-rustdoc-json +T-rustdoc

@rustbot rustbot 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 Aug 15, 2022
@aDotInTheVoid
Copy link
Member Author

Related: #92945

GuillaumeGomez added a commit to GuillaumeGomez/rust that referenced this issue Sep 6, 2022
…GuillaumeGomez

Rustdoc-Json: Store Variant Fields as their own item.

Closes rust-lang#100587
Closes rust-lang#92945

Successor to rust-lang#100762

Unlike that one, we don't have merge `StructType` and `Variant`, as after rust-lang#101386 `Variant` stores enum specific information (discriminant).

Resolves the naming discussion (rust-lang#100762 (comment)) by having seperate enums for struct and enum kinds

Resolves `#[doc(hidden)]` on tuple structs (rust-lang#100762 (comment)) by storing as a `Vec<Option<Id>>`

r? `@GuillaumeGomez`
@bors bors closed this as completed in 065e0b9 Sep 6, 2022
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 T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.
Projects
None yet
2 participants