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 misses certain impl's #17006

Closed
alexchandel opened this issue Sep 5, 2014 · 7 comments
Closed

rustdoc misses certain impl's #17006

alexchandel opened this issue Sep 5, 2014 · 7 comments
Labels
T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.

Comments

@alexchandel
Copy link

When rustdoc is run on libcore with JSON output, the output doesn't include several implementations, including one in finally.rs. In particular Drop for Finallyalizer isn't detected:

impl<'a,A> Drop for Finallyalizer<'a,A>

Rustdoc should pick up every syntax element.

@nodakai
Copy link
Contributor

nodakai commented Sep 5, 2014

Is it perhaps because Finallyalizer is not public?

https://github.com/rust-lang/rust/blob/master/src/libcore/finally.rs#L105

Sorry if my answer is off the point, I'm a newbie... Anyways it would be great if rustdoc accepts cmd line parameters on visibility.

$ javadoc -help
usage: javadoc [options] [packagenames] [sourcefiles] [@files]
-overview <file>          Read overview documentation from HTML file
-public                   Show only public classes and members
-protected                Show protected/public classes and members (default)
-package                  Show package/protected/public classes and members
-private                  Show all classes and members
(...snip...)

@alexchandel
Copy link
Author

@nodakai
I don't think so, because rustdoc gets several private implementations. For example, it documents impl Char for char in char.rs.

Actually it's even worse, since rustdoc misses the fn is_digit_radix method in impl Char for char, yet documents every method.

Edit: user error

@huonw
Copy link
Member

huonw commented Sep 5, 2014

@alexchandel could you be more specific? I don't understand why Char for char is a private implementation? I can also see is_digit_radix just fine.

Does it miss it specifically for the JSON output?

@nodakai
Copy link
Contributor

nodakai commented Sep 6, 2014

@alexchandel My understanding on the "is-a" relationship for impl Trait for Type is

  1. if either of Trait or Type is private, there's no way to referring to the relationship from outside, so the relationship is kinda private
  2. otherwise the relationship is automatically public and rustdoc picks it up

It would be nice if the Rust language spec could explain this more clearly.

@huonw
Copy link
Member

huonw commented Sep 6, 2014

I don't think this is a bug:

  • Finallyalizer is private, and doesn't appear in the docs at all anyway (which is correct), so it makes sense that the impl is also not shown.
  • char is a "global" type, and any implementations of public traits for it are public.

Closing as not-a-bug. Reopen if I'm misunderstanding something.

@nodakai

I think it's better to regard this behaviour as rustdoc documenting public things. Public traits are listed in the docs, public types are listed in the docs, and the interaction between the documented things (i.e. the traits-in-the-docs impl'd by each type-in-the-docs) is also listed.

Anyways it would be great if rustdoc accepts cmd line parameters on visibility.

This can actually controlled by the --passes argument, see rustdoc --passes list.

@huonw huonw closed this as completed Sep 6, 2014
@alexchandel
Copy link
Author

@huonw

Running rustdoc --passes collapse-docs -w json libcore/lib.rs still strips private items, including Finallyalizer. How do I document every item, including private ones?

@huonw
Copy link
Member

huonw commented Sep 7, 2014

I think you may need to pass the flag that disables the default passes too (I can't remember what it is, see rustdoc --help).

lnicola pushed a commit to lnicola/rust that referenced this issue Apr 7, 2024
lnicola pushed a commit to lnicola/rust that referenced this issue Apr 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

4 participants