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

bitflags!-generated public API has poor documentation UX #18227

Closed
sfackler opened this issue Oct 22, 2014 · 11 comments
Closed

bitflags!-generated public API has poor documentation UX #18227

sfackler opened this issue Oct 22, 2014 · 11 comments
Labels
T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.

Comments

@sfackler
Copy link
Member

Say I'm at the documentation page for std::io::fs::mkdir and want to figure out how to call it: http://doc.rust-lang.org/std/io/fs/fn.mkdir.html. I want to figure out what the FilePermission type is, so I click on the link to its docs. I get sent here: http://doc.rust-lang.org/std/io/struct.FilePermission.html. Unfortunately, that page gives no indication at all of how actually initialize a FilePermission in a useful way. I have to somehow divine that I need to jump out to the documentation for the io module and scroll all the way to the bottom to the constants section: http://doc.rust-lang.org/std/io/index.html#constants to actually find some useful values to pass to mkdir.

Associated constants would help with this, as would sufficient compiler support to implement a robust EnumSet.

@sfackler sfackler added A-libs T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. labels Oct 22, 2014
@aturon
Copy link
Member

aturon commented Oct 22, 2014

cc @bjz

@sfackler
Copy link
Member Author

EnumSet seems cleaner to me personally, but the usability wouldn't be as nice unless we could make MyEnum::Foo | MyEnum::Bar turn into EnumSet<MyEnum>.

@aturon
Copy link
Member

aturon commented Oct 22, 2014

We could potentially hack this without associated constants by providing constructor functions corresponding to each constant. But that's pretty ugly.

My recollection is that EnumSet suffered from other usability problems in terms of coding in a C-like style with the flags, but it's been a long time since I looked at it.

@aturon
Copy link
Member

aturon commented Oct 22, 2014

Hah, @sfackler beat me to it. :-)

@sfackler
Copy link
Member Author

We could also define EnumSet::of([Foo, Bar]), assuming C-like enums are Copy. It's a bit more Java-like than C-like but not too bad.

@steveklabnik
Copy link
Member

Triage: the motivating example is gone, but i'm guessing the issue still persists.

@sfackler
Copy link
Member Author

The bitflags macro has been pulled out to a separate crate, so this issue can probably be migrated: http://doc.rust-lang.org/rustc_bitflags/macro.bitflags!.html

@sfackler
Copy link
Member Author

cc @nick29581

@steveklabnik
Copy link
Member

http://doc.rust-lang.org/bitflags/bitflags/index.html is the new link, and yeah, this still persists. Not moving because this will still affect any user macro docs, but removing a-libs since this is really just a rustdoc issue.

@steveklabnik
Copy link
Member

This is actually a dup of #17616

@durka
Copy link
Contributor

durka commented Nov 16, 2015

@steveklabnik not a dupe. The motivating example was this I guess, whereas #17616 is about rustdocking the macro itself.

lnicola pushed a commit to lnicola/rust that referenced this issue Oct 8, 2024
…nyyx, r=davidbarsky

internal: add json `tracing` Layer for profiling startup

On `buck2/integrations/rust-project`, this results in the following being printed:

```json
{"name":"discover_command","elapsed_ms":18703}
{"name":"parallel_prime_caches","elapsed_ms":0}
{"name":"vfs_load","elapsed_ms":5895}
{"name":"vfs_load","elapsed_ms":547}
{"name":"parallel_prime_caches","elapsed_ms":23}
{"name":"parallel_prime_caches","elapsed_ms":84}
{"name":"parallel_prime_caches","elapsed_ms":5819}
```
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

5 participants