-
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
De-emphasize unstable items in rustdoc item table #118226
Conversation
(rustbot has picked a reviewer for you, use r? to override) |
Some changes occurred in HTML/CSS/JS. cc @GuillaumeGomez, @jsha |
item.stability(tcx).as_ref().map(|s| s.is_unstable() && s.feature != sym::rustc_private) | ||
== Some(true) |
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.
item.stability(tcx).as_ref().map(|s| s.is_unstable() && s.feature != sym::rustc_private) | |
== Some(true) | |
item.stability(tcx).as_ref().is_some_and(|s| s.is_unstable() && s.feature != sym::rustc_private) |
I would like to remark that the current color (text: Adding opacity to them (text: It would be better to use another color rather the adjusting the opacity, but it's a bigger change. |
In any case, the experimental items are marked as such. Not sure the color change is really improving anything here. |
☔ The latest upstream changes (presumably #118232) made this pull request unmergeable. Please resolve the merge conflicts. |
As far as I can tell from those PR descriptions, the un-fading was unintentional. Coincidentally, I had been meaning to propose un-fading these for accessibility and clarity reasons. Though I agree that if the un-fading was intentional the right thing to do is to revert it, then discuss making the change intentionally. For context here's my thinking about fading: As @Urgau points out, it reduces the contrast below recommended accessibility standards. Also it's very implicit and hard to figure out on its own. In the first screenshot, there are three different ways that the unstable items are marked:
We only need one of these. We should avoid fading for the reasons above. We should avoid sort order because it's implicit, not explicit. IMO the TraitsCopy Types whose values can be duplicated simply by copying bits. Traits (Experimental)Destruct A marker for types that can be dropped. |
Replace `option.map(cond) == Some(true)` with `option.is_some_and(cond)` Requested by `@fmease` in rust-lang#118226 (review). There is also a much larger number of `option.map_or(false, cond)` that can be changed separately if someone wants. r? fmease
Rollup merge of rust-lang#118253 - dtolnay:issomeand, r=compiler-errors Replace `option.map(cond) == Some(true)` with `option.is_some_and(cond)` Requested by `@fmease` in rust-lang#118226 (review). There is also a much larger number of `option.map_or(false, cond)` that can be changed separately if someone wants. r? fmease
FWIW I strongly disagree. Nightly features shouldn't be in the stable documentation in the first place – because they're not just experimental, they're literally not available! – and if they have to be because reasons, they should at least be as far separated and de-emphasized from actual available items as possible. They're simply visual noise that makes it more difficult to skim and scan the docs and find what you want – and even worse, in the sidebar they're not distinguished at all! Particularly It gives an impression that nightly Rust is the "preferred" version to use, even after eight years since 1.0. (Why isn't there even "Auto-hide experimental items" in the settings dropdown?)
This would be better than nothing indeed. |
That's actually a pretty good question! I think I'd prefer this solution instead. |
I'd prefer not to do that. It seems too much like treating configuration options as a crutch. If they're only available on nightly toolchains, then only nightly toolchains should have them in the docs. Additionally, since many people use nightly toolchains specifically to access experimental features, they shouldn't be de-emphasized when they appear in nightly docs. |
It sounds like there are multiple compelling reasons not to use opacity like this, even if originally removing it was unintentional. Thanks for the review! |
For many years, since 0a46933 unstable APIs used to be shown in a faded color (both the item name and the description). See https://doc.rust-lang.org/1.54.0/std/marker/index.html.
In #85651 the description became un-faded. See https://doc.rust-lang.org/1.55.0/std/marker/index.html.
In #107336 the item name became un-faded too. Compare https://doc.rust-lang.org/1.68.0/std/marker/index.html vs https://doc.rust-lang.org/1.69.0/std/marker/index.html.
It is difficult for me to tell whether either of these changes was intentional. None of the PR descriptions or commit messages even mentions stability at all.
This PR restores fading the unstable item name. I find this visual separation to be helpful in getting oriented about the sort order of the items.
Before:
After:
(the screenshots also include my other PR #118224.)