cargo-public-api icon indicating copy to clipboard operation
cargo-public-api copied to clipboard

Struct fields of enum tuple struct are not included in the output

Open Enselic opened this issue 3 years ago • 1 comments

Consider this code in src/lib.rs:

enum Foo {
  Bar(usize)
}

This code contains at least 3 public items:

  1. The enum itself
  2. The enum variant Bar which is a tuple struct variant
  3. The struct field called 0 of type usize that corresponds to the first field of the enum variant tuple struct Bar

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.

Enselic avatar Feb 13 '22 17:02 Enselic

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)

Enselic avatar Jun 20 '22 19:06 Enselic

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.

Enselic avatar Aug 13 '22 12:08 Enselic

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.

Enselic avatar Aug 20 '22 13:08 Enselic

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.

Enselic avatar Sep 06 '22 19:09 Enselic