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

Multiple doc issues with "Important Traits" feature #46352

Closed
Diggsey opened this issue Nov 28, 2017 · 5 comments
Closed

Multiple doc issues with "Important Traits" feature #46352

Diggsey opened this issue Nov 28, 2017 · 5 comments
Assignees
Labels
A-docs Area: Documentation for any part of the project, including the compiler, standard library, and tools T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.

Comments

@Diggsey
Copy link
Contributor

Diggsey commented Nov 28, 2017

First example: https://doc.rust-lang.org/nightly/std/vec/struct.Vec.html#method.with_capacity

  • On the tool-tip the dark red and cyan text on a black background are very hard to read, and the use of very bold white text on a solid black background looks out of place in the documentation.

  • The traits shown are not important. Every function which returns a Vec will now have an information icon explaining that Vec<u8> implements Write.

  • It's strange that the "information" icon on a function is related specifically to the return type of that function.

Second example: https://doc.rust-lang.org/nightly/std/vec/struct.Vec.html#method.into_boxed_slice

  • The tool-tip will arbitrarily pick the first type to display in the event that there are multiple possibilities. (In this case it picks Box<I> where the type parameter I means nothing at that point)

  • The modal dialog needs more spacing and probably a border.

  • Increases the inconsistency in style of the documentation. The docs used to be so simple that they did seem to have a consistent style throughout. Now rustdoc has a lot more features, and the mishmash of different styles is becoming an issue. Adding a whole new model dialog component doesn't help.

Some suggestions for improvements:

  • Use a normal tool-tip
  • Only show traits which are implemented for a super-set of the types returned by a function, so:
Impl. def.                Return type    Shown?
-----------------------------------------------
impl Write for Vec<u8>    Vec<T>         No
impl Write for Vec<u8>    Vec<u8>        Yes
impl Write for Vec<T>     Vec<T>         Yes
impl Write for Vec<T>     Vec<u8>        Yes
  • Show the return type on the tool-tip, not the type which is mentioned in the impl. definition.

Overall, I don't think that putting this information in a modal is the best option. Personally I think it would make more send to just add a "Return value" section, and put the information in there. It will make the documentation for those functions more verbose, but it will reduce the complexity of the documentation as a whole, and keep everything consistent.

@scottmcm
Copy link
Member

More: https://doc.rust-lang.org/nightly/std/vec/struct.Vec.html#impl-Index%3Cusize%3E

  • It seems everything returning a reference explains that &mut T: Iterator
  • It's telling me about &mut T for a method that returns &T

@GuillaumeGomez
Copy link
Member

Working on it.

@GuillaumeGomez GuillaumeGomez self-assigned this Nov 29, 2017
@GuillaumeGomez GuillaumeGomez added T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. A-docs Area: Documentation for any part of the project, including the compiler, standard library, and tools labels Nov 29, 2017
@GuillaumeGomez
Copy link
Member

Wrote the fix, looks like this:

screen shot 2017-11-29 at 19 23 01

I'll open the PR tomorrow.

arielb1 pushed a commit to arielb1/rust that referenced this issue Nov 30, 2017
…Misdreavus

Invert colors in important traits tooltip

Part of rust-lang#46352.

r? @QuietMisdreavus
kennytm added a commit to kennytm/rust that referenced this issue Dec 1, 2017
…Misdreavus

Invert colors in important traits tooltip

Part of rust-lang#46352.

r? @QuietMisdreavus
@GuillaumeGomez
Copy link
Member

Merged so I suppose it can be closed now. Don't hesitate to tell if I forgot something.

@pravic
Copy link
Contributor

pravic commented Feb 22, 2018

I could not find the source of this feature, so I'll write here.

  1. What is the idea behind it?

  2. Only one of the original issues were closed in Invert colors in important traits tooltip #46392. Rest are alive still.

  3. The exclamation icon looks ugly (not aliased).

  4. Font of the tooltip is a bit blurred.

  5. And not related here, but anyway: that empty square inside the "Nightly only" warning. I suppose there must be some character or icon (<span class="microscope">🔬</span>).

Chrome 64, Windows 7/10.

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-docs Area: Documentation for any part of the project, including the compiler, standard library, and tools 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