cargo-public-api
cargo-public-api copied to clipboard
Struct fields of enum tuple struct are not included in the output
Consider this code in src/lib.rs
:
enum Foo {
Bar(usize)
}
This code contains at least 3 public items:
- The enum itself
- The enum variant
Bar
which is a tuple struct variant - The struct field called
0
of typeusize
that corresponds to the first field of the enum variant tuple structBar
With the new ItemIterator
architecture (see https://github.com/Enselic/public_items/pull/15), the struct field (i.e. item 3 in the list above) will be completely missing from the output. That is because it is not references by the enum variant.
This is not that big of a deal since the tuple type on Bar
itself conveys enough information to make conclusions about if the API has changed.
This will be fixed more or less automatically when https://github.com/rust-lang/rust/issues/92945 is fixed.
I don't think it is fair to classify this as a limitation since the tuple struct type contains all relevant info
(I filed this issue before type information was included in the output IIRC)
I don't think this issue is worth keeping open. The upstream PR has been abandoned. If upstream picks this up later, we will of course adapt, but the issue per se has no bearing on the value proposition of this tool. And I like to keep the issue inbox clean.
Closing.
This has been picked up again upstreams, see https://github.com/Enselic/cargo-public-api/pull/99
So it currently looks like this will be fixed in the coming days.
Re-opening.
The upstream support will land any day now (see https://github.com/Enselic/cargo-public-api/pull/99 and referenced issue). But I have done some more thinking, and I don't think doing what this ticket is about contributes any relevant info. The rustdoc JSON data is there if we change our mind, but for now I do not think we should do this.