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 - display since version for stable items #30686

Merged
merged 1 commit into from
Feb 10, 2016

Conversation

wesleywiser
Copy link
Member

Here's some screenshots after this change:

screen shot 2016-01-03 at 11 38 30 am
screen shot 2016-01-03 at 11 40 39 am
screen shot 2016-01-03 at 11 42 17 am

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

@sfackler
Copy link
Member

sfackler commented Jan 3, 2016

Yay!

@tshepang
Copy link
Member

tshepang commented Jan 3, 2016

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.

@wesleywiser
Copy link
Member Author

@tshepang What do you think of this?
screen shot 2016-01-03 at 5 14 51 pm

@tshepang
Copy link
Member

tshepang commented Jan 3, 2016

@wesleywiser that's better, thanks

@brson
Copy link
Contributor

brson commented Jan 5, 2016

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.

@wesleywiser
Copy link
Member Author

@brson re 'since': I agree. Here's what it looks like without 'since':
screen shot 2016-01-05 at 9 42 36 pm

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 Option is marked 1.0.0:
screen shot 2016-01-05 at 9 48 41 pm

@tshepang
Copy link
Member

tshepang commented Jan 6, 2016

I like the second option:

...only show the version number when it is different than the containing object's version number.

@wesleywiser wesleywiser force-pushed the rustdoc_display_since branch from d2a35e5 to 5c5dab2 Compare January 6, 2016 23:12
@brson
Copy link
Contributor

brson commented Jan 12, 2016

@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.

@steveklabnik
Copy link
Member

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.

@wesleywiser
Copy link
Member Author

@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.

@steveklabnik
Copy link
Member

No worries at all :)

@steveklabnik
Copy link
Member

@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> {
Copy link
Member

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.

@wesleywiser wesleywiser force-pushed the rustdoc_display_since branch from 5c5dab2 to 75acee2 Compare February 10, 2016 02:20
@wesleywiser
Copy link
Member Author

@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).

@steveklabnik
Copy link
Member

@bors: r+

okay, let's give it a try! 🎊

@bors
Copy link
Contributor

bors commented Feb 10, 2016

📌 Commit 75acee2 has been approved by steveklabnik

bors added a commit that referenced this pull request Feb 10, 2016
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
@bors
Copy link
Contributor

bors commented Feb 10, 2016

⌛ Testing commit 75acee2 with merge b5da60d...

@bors bors merged commit 75acee2 into rust-lang:master Feb 10, 2016
bors added a commit to rust-lang-ci/rust that referenced this pull request Nov 29, 2023
…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`
bors added a commit to rust-lang-ci/rust that referenced this pull request Apr 19, 2024
…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`
github-actions bot pushed a commit to rust-lang/miri that referenced this pull request Apr 20, 2024
…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`
RalfJung pushed a commit to RalfJung/rust-analyzer that referenced this pull request Apr 20, 2024
…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`
RalfJung pushed a commit to RalfJung/rust-analyzer that referenced this pull request Apr 27, 2024
…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`
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.

7 participants