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

Trait impls missing when generating rustdoc JSON without --document-private-items flag #32

Closed
2 tasks done
obi1kenobi opened this issue Aug 7, 2022 · 2 comments
Closed
2 tasks done
Labels
A-lint Area: new or existing lint C-bug Category: doesn't meet expectations

Comments

@obi1kenobi
Copy link
Owner

obi1kenobi commented Aug 7, 2022

For unknown reasons, rustdoc JSON output sometimes does not include information about all the traits implemented by a type unless --document-private-items is specified. For example, in this clap semver regression:

  • The following invocation on v3.1.18 generates JSON stating that UnwindSafe is implemented for ArgMatches: cargo rustdoc --lib --all-features -- --document-private-items -Zunstable-options --output-format json
  • However, the following invocation has no mention of UnwindSafe for ArgMatches at all: cargo rustdoc --lib --all-features -- -Zunstable-options --output-format json

It's unclear to me at the moment whether this is expected behavior from rustdoc, or a bug. Will triage and use this as a tracking issue.

In the meantime:

  • the docs should recommend --document-private-items and --all-features in the rustdoc invocation
  • the GitHub Action should use both of these flags by default
@obi1kenobi obi1kenobi changed the title Trait impls missing when generating rustdoc JSON without --document-private-items flag Trait impls missing when generating rustdoc JSON without --document-private-items flag Aug 7, 2022
@camelid
Copy link

camelid commented Aug 8, 2022

Hi, I work on rustdoc, although I'm not super familiar with the JSON backend. This sounds like a bug to me since the UnwindSafe impl is public API. Can you open an issue for this at rust-lang/rust?

@epage epage added A-lint Area: new or existing lint C-bug Category: doesn't meet expectations labels Aug 9, 2022
@obi1kenobi
Copy link
Owner Author

I believe this was fixed upstream on one of the more recent nightlies. Closing for now, willing to reopen if we find more regressions. Having --document-private-items probably makes the checking a bit slower but probably not meaningfully so, and we can revisit whether we add it by default when the JSON format is closer to stabilization.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-lint Area: new or existing lint C-bug Category: doesn't meet expectations
Projects
None yet
Development

No branches or pull requests

3 participants