Rustdoc label trait feature#157058
Conversation
|
Some changes occurred in compiler/rustc_attr_parsing cc @jdonszelmann, @JonathanBrouwer Some changes occurred in compiler/rustc_passes/src/check_attr.rs cc @jdonszelmann, @JonathanBrouwer Some changes occurred in HTML/CSS/JS. cc @GuillaumeGomez, @lolbinarycat rust-analyzer is developed in its own repository. If possible, consider making this change to rust-lang/rust-analyzer instead. cc @rust-lang/rust-analyzer Some changes occurred in compiler/rustc_hir/src/attrs |
|
r? @fmease rustbot has assigned @fmease. Use Why was this reviewer chosen?The reviewer was selected based on:
|
This comment has been minimized.
This comment has been minimized.
There was a problem hiding this comment.
This is mostly a copy from notable_trait, should be updated.
There was a problem hiding this comment.
Should not be here, only in rustdoc book considering it's a rustdoc attribute.
There was a problem hiding this comment.
I removed it, but seeing src/doc/unstable-book/src/language-features/doc-notable-trait.md is making me push back lightly on that, are you sure about your feedback? - or should we clean up other doc attributes that shouldn't be here (in other pr)?
| /// Relative URL to the trait page, or empty when not linkable. | ||
| href: String, |
There was a problem hiding this comment.
should it be an option?
There was a problem hiding this comment.
I think we should always link to the trait, so I'd say no.
There was a problem hiding this comment.
Maybe doc_hidden would make us not be able to do so ? It would be quite far-fetched to add label_trait to doc_hidden but... Maybe other cases like... visibility? not sure.
I would generated the color hash from the trait path (so |
|
|
||
| let Some(impls) = cx.cache().impls.get(&did) else { return Vec::new() }; | ||
|
|
||
| let mut out: Vec<LabelTraitInfo> = impls |
There was a problem hiding this comment.
Instead of using a Vec, would be better to use a BTreeMap. It's sorted on insert and prevents duplications.
There was a problem hiding this comment.
I changed to do that but then collect it to Vec, keeping this discussion opened as I'm not sure if you meant something else.
| // FIXME: valid for traits, should be checked in attr_parsing | ||
| label_trait: _, |
There was a problem hiding this comment.
should we have strong verification on which items those are applied?
This comment has been minimized.
This comment has been minimized.
2977320 to
6cddf7b
Compare
View all comments
its full path->Should the following be out of scope ?
#[doc(label_trait(color="0xff0000")])