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: Another round of improvements #24396

Merged
merged 3 commits into from
Apr 16, 2015
Merged

Conversation

alexcrichton
Copy link
Member

A few final improvements to rustdoc for 1.0:

  • Improve how rustdoc handles stability
  • Fix cross-crate macro source links
  • Improve experience of types inheriting methods through Deref

Some more details can be found in the commits.

Preview

@rust-highfive
Copy link
Collaborator

r? @pcwalton

(rust_highfive has picked a reviewer for you, use r? to override)

@alexcrichton
Copy link
Member Author

@rust-highfive rust-highfive assigned aturon and unassigned pcwalton Apr 14, 2015
@sfackler
Copy link
Member

Yay! It'd be nice to identify deprecated stuff in search results as well.

@wycats
Copy link
Contributor

wycats commented Apr 14, 2015

r+ x 1000. It would be useful to get before and after screenshots for rustdoc changes 😄

@tomjakubowski
Copy link
Contributor

Wow, fantastic work as always Alex! I love the changes to stability and of course the "Methods from Deref" sections/

@killercup
Copy link
Member

Wow, those unstable/deprecated boxes are huge! I'd probably make them look a bit less… alerting, e.g. by using a border-size of only 1px and not make the whole text italic. Might be good to add some margin-bottom to them, as well.

Oh, an here are some screenshots, for posterity.

std__io__charserror_-_rust
std__rand_-_rust

@steveklabnik
Copy link
Member

I agree that overall this is an improvement, but agree with @killercup that it's a bit big.

@alexcrichton
Copy link
Member Author

Yeah I definitely wouldn't slate myself as a graphic designer any time soon!

@wycats you can compare/contrast the current docs to the hosted docs (what I've been doing) for example:

type old new
Vec old new
old_io old new
io old new

@liigo
Copy link
Contributor

liigo commented Apr 15, 2015

Another great feature's screenshot, thanks to @alexcrichton !
Vec methods from Deref:

vec-deref-methods

@aturon
Copy link
Member

aturon commented Apr 15, 2015

This is really awesome work, @alexcrichton! The docs are feeling much more polished, and I really like the Deref treatment.

I do agree with others that the unstable/deprecation warnings are a bit too attention-getting. I suspect that some fairly simple changes to the styling could de-emphasize them, and that seems worth doing in this PR.

@alexcrichton
Copy link
Member Author

Ok I've pushed a few tweaks to the style (and re-uploaded the docs). I incorporated @killercup's suggestions (thanks!) and also made the font size a little smaller. I do think that it's still a little jarring but much less so than before!

@steveklabnik
Copy link
Member

👍

@killercup
Copy link
Member

👍

(The padding on the bottom looks a bit off to me, but that's nothing major. I'd probably set it to 5px 5px 2px or something like that.)

@aturon
Copy link
Member

aturon commented Apr 15, 2015

Thanks @alexcrichton! The code looks good to me as well, so:

@bors: r+

@bors
Copy link
Contributor

bors commented Apr 15, 2015

📌 Commit cdb1d95 has been approved by aturon

@bors
Copy link
Contributor

bors commented Apr 15, 2015

⌛ Testing commit cdb1d95 with merge 141a48a...

bors added a commit that referenced this pull request Apr 15, 2015
A few final improvements to rustdoc for 1.0:

* Improve how rustdoc handles stability
* Fix cross-crate macro source links
* Improve experience of types inheriting methods through `Deref`

Some more details can be found in the commits.

[Preview](http://people.mozilla.org/~acrichton/doc/std/)
@bors
Copy link
Contributor

bors commented Apr 15, 2015

💔 Test failed - auto-linux-64-nopt-t

@alexcrichton
Copy link
Member Author

@bors: retry

On Wed, Apr 15, 2015 at 2:05 PM, bors notifications@github.com wrote:

[image: 💔] Test failed - auto-linux-64-nopt-t
http://buildbot.rust-lang.org/builders/auto-linux-64-nopt-t/builds/4479


Reply to this email directly or view it on GitHub
#24396 (comment).

@bors
Copy link
Contributor

bors commented Apr 16, 2015

☔ The latest upstream changes (presumably #23682) made this pull request unmergeable. Please resolve the merge conflicts.

attr::Unstable => "unstable".to_string(),
attr::Stable => String::new(),
};
if s.deprecated_since.len() > 0 {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@alexcrichton if !s.deprecated_since.is_empty() {?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

disregard! i hadn't noticed that the conflict is not yet resolved here

This commit is an overhaul to how rustdoc deals with stability of the standard
library. The handling has all been revisited with respect to Rust's current
approach to stability in terms of implementation as well as the state of the
standard library today. The high level changes made were:

* Stable items now have no marker by default
* Color-based small stability markers have been removed
* Module listings now fade out unstable/deprecated items slightly
* Trait methods have a separate background color based on stability and also
  list the reason that they are unstable.
* `impl` blocks with stability no longer render at all. This may be re-added
  once the compiler recognizes stability on `impl` blocks.
* `impl` blocks no longer have stability of the methods implemente indicated
* The stability summary has been removed

Closes rust-lang#15468
Closes rust-lang#21674
Closes rust-lang#24201
The source filename for cross crate macros isn't quite right so the normal
generated links are invalid.

Closes rust-lang#21311
@alexcrichton
Copy link
Member Author

@bors: r=aturon a1378ff

@bors
Copy link
Contributor

bors commented Apr 16, 2015

⌛ Testing commit a1378ff with merge 3eef83e...

@bors
Copy link
Contributor

bors commented Apr 16, 2015

💔 Test failed - auto-linux-64-x-android-t

Whenever a type implements Deref, rustdoc will now add a section to the "methods
available" sections for "Methods from Deref<Target=Foo>", listing all the
inherent methods of the type `Foo`.

Closes rust-lang#19190
@alexcrichton
Copy link
Member Author

@bors: r=aturon 71c1b5b

bors added a commit that referenced this pull request Apr 16, 2015
A few final improvements to rustdoc for 1.0:

* Improve how rustdoc handles stability
* Fix cross-crate macro source links
* Improve experience of types inheriting methods through `Deref`

Some more details can be found in the commits.

[Preview](http://people.mozilla.org/~acrichton/doc/std/)
@bors
Copy link
Contributor

bors commented Apr 16, 2015

⌛ Testing commit 71c1b5b with merge 1014ac4...

@bors bors merged commit 71c1b5b into rust-lang:master Apr 16, 2015
@Stebalien
Copy link
Contributor

Nice. However, IMHO, the Deref docs shouldn't include static methods.

@tomjakubowski
Copy link
Contributor

Probably worth filing an issue for that

@Stebalien
Copy link
Contributor

@tomjakubowski

Probably worth filing an issue for that

Good point. Done.

@SimonSapin
Copy link
Contributor

This is great! Thanks Alex.

Improve experience of types inheriting methods through Deref

The commit message says this is only inherent methods through Deref. Would it make sense to also show methods available through trait implementations on the Deref target?

@alexcrichton alexcrichton deleted the rustdoc2 branch April 21, 2015 15:15
@alexcrichton
Copy link
Member Author

@SimonSapin my thinking was that the target of the Deref impl generally doesn't implement traits that the source itself does not. For example the traits implemented by String and str are almost the same, so I didn't think it was worth it to add a section for "trait implementations available as methods through Deref".

I chose to only inline inherent methods because that's the real benefit of Deref in terms of docs, you get new inherent methods you didn't previously have.

@SimonSapin
Copy link
Contributor

Fair enough, especially now that primitive types can have inherent methods and std doesn’t have so many traits.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.