-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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 - display since
version for stable items
#30686
Conversation
Yay! |
I would prefer if the text was less prominent: either greyed or with smaller font. It is too distracting at the moment for something that's so meta. |
@tshepang What do you think of this? |
@wesleywiser that's better, thanks |
I also have the sense that this is giving a great deal of prominence to a rather unimportant piece of information. One thing we could do is remove 'since' - this word doesn't convey any information every time it's repeated. This is also a new way to style stability information, and I already count two - See for example where stability of the element on the page is indicated by a colored box while stability of its methods is indicated by the word '[Unstable]' while fading out the text. It would be easier to understand that this and that are both types of stability information if they were styled similarly. |
@brson re 'since': I agree. Here's what it looks like without 'since': I think agree that adding yet another way to show stability information is bad. I'm having some trouble imagining what a common style might look like. One idea I had that might further minimize the visual noise would be to only show the version number when it is different than the containing object's version number. For example, the previous screenshot would look like this because |
I like the second option:
|
d2a35e5
to
5c5dab2
Compare
@wesleywiser I do like that idea of not displaying them when they are the same. With that I think I'm ok with trying this. |
I basically feel the same as @brson on this thread. Let's give it a try. Let me know when this PR implements that, and we'll merge after the release thursday, assuming you can update it before then. |
@brson @steveklabnik Will do. Sorry, I've been pretty busy lately but hopefully I'll have some time to work on it later this week. I'll post new screenshots when when I update the PR. |
No worries at all :) |
@wesleywiser ping! Any chance you've had the time to work on this? |
@@ -339,6 +339,14 @@ impl Item { | |||
_ => String::new(), | |||
} | |||
} | |||
|
|||
pub fn stable_since(&self) -> Option<String> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you use -> Option<&str>
here instead? It should be enough since the string is only ever passed down. Change s.since.clone()
to &s.since[..]
too and update the other impacted code.
I think this change looks great otherwise.
5c5dab2
to
75acee2
Compare
@steveklabnik Great timing Steve! I think it's mostly working at this point (I looked over the generated docs and didn't see any glaring issues). I've updated this PR with the new code (and also implemented @bluss's suggestion). |
@bors: r+ okay, let's give it a try! 🎊 |
📌 Commit 75acee2 has been approved by |
Here's some screenshots after this change: ![screen shot 2016-01-03 at 11 38 30 am](https://cloud.githubusercontent.com/assets/831192/12079661/23da4e38-b20f-11e5-8c84-ba51d7a59c3f.png) ![screen shot 2016-01-03 at 11 40 39 am](https://cloud.githubusercontent.com/assets/831192/12079663/23e00012-b20f-11e5-9f01-408cc8d43687.png) ![screen shot 2016-01-03 at 11 42 17 am](https://cloud.githubusercontent.com/assets/831192/12079662/23dfe6c2-b20f-11e5-9998-53abc643e2ef.png) I tried to click through the `std` docs and make sure everything that can have stability attributes has it rendered but I'm probably missing some. I'd also appreciate any feedback on the css changes. I had difficulty getting the `since` labels aligning correctly for enum variants. If anyone has a better idea for that, I'd be glad to implement it. Fixes #27607
…sion, r=<try> Always display stability version even if it's the same as the containing item Fixes rust-lang#118439. Currently, if the containing item's version is the same as the item's version (like a method), we don't display it on the item. This was something done on purpose as you can see [here](https://github.com/rust-lang/rust/blob/e9b7bf011478aa8c19ac49afc99853a66ba04319/src/librustdoc/html/render/mod.rs#L949-L955). It was implemented in rust-lang#30686. I think we should change this because on pages with a lot of items, if someone arrives (through the search or a link) to an item far below the page, they won't know the stability version unless they scroll to the top, which isn't great. You can see the result [here](https://rustdoc.crud.net/imperio/display-stability-version/std/pin/struct.Pin.html#method.new). r? `@notriddle`
…sion, r=rustdoc Always display stability version even if it's the same as the containing item Fixes rust-lang#118439. Currently, if the containing item's version is the same as the item's version (like a method), we don't display it on the item. This was something done on purpose as you can see [here](https://github.com/rust-lang/rust/blob/e9b7bf011478aa8c19ac49afc99853a66ba04319/src/librustdoc/html/render/mod.rs#L949-L955). It was implemented in rust-lang#30686. I think we should change this because on pages with a lot of items, if someone arrives (through the search or a link) to an item far below the page, they won't know the stability version unless they scroll to the top, which isn't great. You can see the result [here](https://rustdoc.crud.net/imperio/display-stability-version/std/pin/struct.Pin.html#method.new). r? `@notriddle`
…ustdoc Always display stability version even if it's the same as the containing item Fixes rust-lang/rust#118439. Currently, if the containing item's version is the same as the item's version (like a method), we don't display it on the item. This was something done on purpose as you can see [here](https://github.com/rust-lang/rust/blob/e9b7bf011478aa8c19ac49afc99853a66ba04319/src/librustdoc/html/render/mod.rs#L949-L955). It was implemented in rust-lang/rust#30686. I think we should change this because on pages with a lot of items, if someone arrives (through the search or a link) to an item far below the page, they won't know the stability version unless they scroll to the top, which isn't great. You can see the result [here](https://rustdoc.crud.net/imperio/display-stability-version/std/pin/struct.Pin.html#method.new). r? `@notriddle`
…ustdoc Always display stability version even if it's the same as the containing item Fixes rust-lang/rust#118439. Currently, if the containing item's version is the same as the item's version (like a method), we don't display it on the item. This was something done on purpose as you can see [here](https://github.com/rust-lang/rust/blob/e9b7bf011478aa8c19ac49afc99853a66ba04319/src/librustdoc/html/render/mod.rs#L949-L955). It was implemented in rust-lang/rust#30686. I think we should change this because on pages with a lot of items, if someone arrives (through the search or a link) to an item far below the page, they won't know the stability version unless they scroll to the top, which isn't great. You can see the result [here](https://rustdoc.crud.net/imperio/display-stability-version/std/pin/struct.Pin.html#method.new). r? `@notriddle`
…ustdoc Always display stability version even if it's the same as the containing item Fixes rust-lang/rust#118439. Currently, if the containing item's version is the same as the item's version (like a method), we don't display it on the item. This was something done on purpose as you can see [here](https://github.com/rust-lang/rust/blob/e9b7bf011478aa8c19ac49afc99853a66ba04319/src/librustdoc/html/render/mod.rs#L949-L955). It was implemented in rust-lang/rust#30686. I think we should change this because on pages with a lot of items, if someone arrives (through the search or a link) to an item far below the page, they won't know the stability version unless they scroll to the top, which isn't great. You can see the result [here](https://rustdoc.crud.net/imperio/display-stability-version/std/pin/struct.Pin.html#method.new). r? `@notriddle`
Here's some screenshots after this change:
I tried to click through the
std
docs and make sure everything that can have stability attributes has it rendered but I'm probably missing some. I'd also appreciate any feedback on the css changes. I had difficulty getting thesince
labels aligning correctly for enum variants. If anyone has a better idea for that, I'd be glad to implement it.Fixes #27607