Conversation
|
Some changes occurred in GUI tests. Some changes occurred in HTML/CSS/JS. cc @GuillaumeGomez, @lolbinarycat Some changes occurred in compiler/rustc_attr_parsing cc @jdonszelmann, @JonathanBrouwer Some changes occurred in compiler/rustc_hir/src/attrs |
|
rustbot has assigned @petrochenkov. Use Why was this reviewer chosen?The reviewer was selected based on:
|
| --notable-badge-pink: oklch(0.88 0.21 0); | ||
| --notable-badge-red: oklch(0.88 0.21 40); | ||
| --notable-badge-orange: oklch(0.88 0.21 70); | ||
| --notable-badge-grey: oklch(0.88 0 0); |
There was a problem hiding this comment.
We're now switching to 8 colors?
There was a problem hiding this comment.
I can’t find it in the meeting minutes, but I remember mentioning the possibility of using the ANSI 3-bit color pallet, because it makes both directions of interop easier:
- terminal apps like rusty-man can display these colors without requiring their own bespoke color theming system
- anyone adding new themes to rustdoc-html can easily use a terminal color theme as a starting point
| {% if !notable_trait_badges.is_empty() %} | ||
| <div class="notable-trait-badge-container"> | ||
| {% for badge in notable_trait_badges.iter() %} | ||
| <a class="notable-trait-badge notable-trait-badge-{{badge.color}}" |
There was a problem hiding this comment.
I feel like this is duplicating information: the parent is already the unique class notable-trait-badge-container and the badge itself already has the notable-trait-badge class, so having notable-trait-badge- seems too much (also maybe we should remove the notable-trait-badge class). What about just keeping the color?
There was a problem hiding this comment.
Oh also, please indent. Makes it simpler to read the template.
| border-radius: 6px; | ||
| padding: 8px; | ||
| } | ||
| .notabletrait-badge.light { |
There was a problem hiding this comment.
Same: why changing the color property?
| border-color: #0f1419; | ||
| } | ||
| /* https://github.com/rust-lang/rust/pull/91480 */ | ||
| .notabletrait-badge.light.grey { |
There was a problem hiding this comment.
I'm really not sure it's worth it to show people how to add their own colors.
| padding: 0 0.5rem; | ||
| border-radius: 0.75rem; | ||
| padding: 0 14px; | ||
| border-radius: var(--code-block-border-radius); |
There was a problem hiding this comment.
Why this change?
There was a problem hiding this comment.
It’s the same padding and border radius as code blocks.
There was a problem hiding this comment.
Do we need it to be the same?
There was a problem hiding this comment.
I wanted the text inside the badge to line up with the text in the code block, because it was almost aligned already.
I’m less picky about the border radius, but I made it the same because I was worried about hitting psychovisual weirdness that makes the text look misaligned even if the ruler says it’s perfect.
| --notable-badge-violet: oklch(0.88 0.21 300); | ||
| --notable-badge-magenta: oklch(0.88 0.21 320); | ||
| --notable-badge-cyan: oklch(0.88 0.21 180); | ||
| --notable-badge-transparent: white; |
There was a problem hiding this comment.
I don't think having text floating around is a good idea, especially when it's a color picked by rustdoc automatically...
This comment has been minimized.
This comment has been minimized.
| Transparent, | ||
| } | ||
|
|
||
| impl Into<&'static str> for NotableTraitColor { |
There was a problem hiding this comment.
Should we prefer From ?
Also, should we consider having the opposite direction ? Simplifying the parsing code and grouping similar behaviour in here.
| /// Determines whether an item is annotated with `#[doc(notable_trait)]`. | ||
| query is_doc_notable_trait(def_id: DefId) -> bool { | ||
| /// If an item is annotated with `#[doc(notable_trait)]`, | ||
| /// returns the color used to render its pill. If the crate specifies |
There was a problem hiding this comment.
Is it a pill or a badge ? We should have consistent naming
This comment has been minimized.
This comment has been minimized.
Co-authored-by: Guillaume Gomez <contact@guillaume-gomez.fr>
3e4974b to
ad71924
Compare
|
Some changes occurred in compiler/rustc_attr_ir |
|
This PR was rebased onto a different main commit. Here's a range-diff highlighting what actually changed. Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers. |
This comment has been minimized.
This comment has been minimized.
Add test cases, and the same detailed info block that you get for return position notable traits.
|
@GuillaumeGomez @ThierryBerger I've done some tweaks to take into account feedback from these discussions, plus a few things I noticed while looking around the standard library:
|
ad71924 to
17ce955
Compare
This comment has been minimized.
This comment has been minimized.
This still produces the feature gate error, so it's fine, but it also produces the "trait attribute" warning
View all comments
Part of #45040
Preview
https://notriddle.com/rustdoc-html-demo-13/gui-tests/lib2/notable_trait_colors/struct.NotableTraitColors.html
Screenshots