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

Clarify why fields are omitted in docs #16376

Closed
wants to merge 1 commit into from

Conversation

Projects
None yet
3 participants
@Gankro
Copy link
Contributor

Gankro commented Aug 9, 2014

@lilyball

This comment has been minimized.

Copy link
Contributor

lilyball commented Aug 9, 2014

The wording "private fields omitted" just feels vaguely tautological to me. I mean, they're private, which pretty much by definition means they're not part of the API, so it's basically like saying "omitted fields omitted".

@Gankro

This comment has been minimized.

Copy link
Contributor Author

Gankro commented Aug 9, 2014

To someone new to the language (which our docs should be friendly to!), it might be unclear that being private is the only reason to have the fields omitted from the documentation. This makes it simple and explicit.

@lilyball

This comment has been minimized.

Copy link
Contributor

lilyball commented Aug 9, 2014

@Gankro So far, this is an anecdote about a single person who was new to the language who didn't realize what something meant. Hardly enough data to make any changes over. Personally, I feel that "private fields omitted" just sounds wrong. It makes me want to say "yes rustdoc, that's what private fields do, thanks for telling me".

@sfackler

This comment has been minimized.

Copy link
Member

sfackler commented Aug 9, 2014

I intentionally chose the language "some fields" instead of "private fields" because there are cases other than privacy for which rustdoc will omit a field, e.g. struct Foo { #[doc(hidden)] pub foo: int, }.

@Gankro

This comment has been minimized.

Copy link
Contributor Author

Gankro commented Aug 9, 2014

@sfackler ah! Okay then. Although... why would you do this? To have pseudo-privates...?

@sfackler

This comment has been minimized.

Copy link
Member

sfackler commented Aug 9, 2014

One of the main use cases is to make types that are instantiatable by syntax extensions like this: https://github.com/sfackler/rust-phf/blob/master/phf/src/lib.rs#L45-L54

@Gankro

This comment has been minimized.

Copy link
Contributor Author

Gankro commented Aug 9, 2014

Yep, basically what I was picturing. Sounds good. Closing it up.

@Gankro Gankro closed this Aug 9, 2014

@Gankro Gankro deleted the Gankro:priv-field-docs branch Aug 18, 2014

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.