-
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
Rename #[doc(spotlight)]
to #[doc(notable_trait)]
#80965
Conversation
This comment has been minimized.
This comment has been minimized.
Dang, I wish |
This comment has been minimized.
This comment has been minimized.
r=me once @jyn514 and @GuillaumeGomez have a chance to approve the new name |
d57e377
to
83dbcef
Compare
Note that
|
This comment has been minimized.
This comment has been minimized.
83dbcef
to
0061051
Compare
Also note that this only changes the user interface; internally in rustdoc it's still called spotlight. That's because this will likely conflict with #80914 and I want to minimize the conflicts and unnecessary work :) |
I used my own rustc-dev-guide docs for this ^^ |
This comment has been minimized.
This comment has been minimized.
I would strongly prefer to deprecate |
Oh, you did that, sorry. I didn't realize it from the PR description. |
0061051
to
ff1fddf
Compare
Can you add a test that |
I used the established method for renaming the feature gate, but |
This comment has been minimized.
This comment has been minimized.
Huh, why did this test fail?
Seems like a weird spurious issue... |
ff1fddf
to
dd926ab
Compare
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
63176c5
to
bc2057a
Compare
This comment has been minimized.
This comment has been minimized.
bc2057a
to
a587cb0
Compare
This comment has been minimized.
This comment has been minimized.
a587cb0
to
01d6a5a
Compare
This comment has been minimized.
This comment has been minimized.
"spotlight" is not a very specific or self-explaining name. Additionally, the dialog that it triggers is called "Notable traits". So, "notable trait" is a better name. * Rename `#[doc(spotlight)]` to `#[doc(notable_trait)]` * Rename `#![feature(doc_spotlight)]` to `#![feature(doc_notable_trait)]` * Update documentation * Improve documentation
01d6a5a
to
34c6cee
Compare
Triage: can any of the reviewers here weigh in on the new revision? |
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.
Sorry for the delay. r=me with the nit addressed.
String::from("notable_trait"), | ||
Applicability::MachineApplicable, | ||
); | ||
diag.note("`doc(spotlight)` is now a no-op"); |
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.
Nah, this seems fine.
Rustdoc keeps a list of a few traits that are believed to be "fundamental" to | ||
types that implement them. These traits are intended to be the primary interface | ||
for their implementers, and are often most of the API available to be documented | ||
on their types. For this reason, Rustdoc will track when a given type implements | ||
one of these traits and call special attention to it when a function returns one | ||
of these types. This is the "Notable traits" dialog, accessible as a circled `i` | ||
button next to the function, which, when clicked, shows the dialog. | ||
|
||
In the standard library, some of the traits that are part of this list are | ||
`Iterator`, `Future`, `io::Read`, and `io::Write`. However, rather than being | ||
implemented as a hard-coded list, these traits have a special marker attribute | ||
on them: `#[doc(notable_trait)]`. This means that you can apply this attribute | ||
to your own trait to include it in the "Notable traits" dialog in documentation. | ||
|
||
The `#[doc(notable_trait)]` attribute currently requires the `#![feature(doc_notable_trait)]` | ||
feature gate. For more information, see [its chapter in the Unstable Book][unstable-notable_trait] | ||
and [its tracking issue][issue-notable_trait]. | ||
|
||
[unstable-notable_trait]: ../unstable-book/language-features/doc-notable-trait.html | ||
[issue-notable_trait]: https://github.com/rust-lang/rust/issues/45040 |
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.
nit: is there a reason you rewrapped this? Did you change any of the text or just the wrapping?
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.
I did change the text; I changed mentions of "spotlight" to "notable trait", and I tweaked some of the wording. Sorry for the re-wrap, I know it's hard to review. I use gqap in Vim whenever I add text so that I don't end up with super long lines.
Here's the Git word-diff output, which should hopefully be easier to review:
diff --git a/old.md b/new.md
index 02a6f7b..92322be 100644
--- a/old.md
+++ b/new.md
@@ -1,20 +1,22 @@
### Adding your trait to the [-"Important Traits"-]{+"Notable traits"+} dialog
Rustdoc keeps a list of a few traits that are believed to be "fundamental" to
[-a given type when-]
[-implemented on it.-]{+types that implement them.+} These traits are intended to be the primary interface
for their [-types,-]{+implementers,+} and are often {+most of+} the [-only thing-]{+API+} available to be documented
on their types. For this reason, Rustdoc will track when a given type implements
one of these traits and call special attention to it when a function returns one
of these types. This is the [-"Important Traits"-]{+"Notable traits"+} dialog, [-visible-]{+accessible+} as a [-circle-i-]{+circled `i`+}
button next to the function, which, when clicked, shows the dialog.
In the standard library, {+some of+} the traits that [-qualify for inclusion-]{+are part of this list+} are
`Iterator`, {+`Future`,+} `io::Read`, and `io::Write`. However, rather than being
implemented as a hard-coded list, these traits have a special marker attribute
on them: [-`#[doc(spotlight)]`.-]{+`#[doc(notable_trait)]`.+} This means that you [-could-]{+can+} apply this attribute
to your own trait to include it in the [-"Important Traits"-]{+"Notable traits"+} dialog in documentation.
The [-`#[doc(spotlight)]`-]{+`#[doc(notable_trait)]`+} attribute currently requires the [-`#![feature(doc_spotlight)]`-]{+`#![feature(doc_notable_trait)]`+}
feature gate. For more information, see [its chapter in the Unstable [-Book][unstable-spotlight]-]{+Book][unstable-notable_trait]+}
and [its tracking [-issue][issue-spotlight].-]{+issue][issue-notable_trait].+}
[-[unstable-spotlight]: ../unstable-book/language-features/doc-spotlight.html-]
[-[issue-spotlight]:-]{+[unstable-notable_trait]: ../unstable-book/language-features/doc-notable-trait.html+}
{+[issue-notable_trait]:+} https://github.com/rust-lang/rust/issues/45040
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.
Ok cool, I am not sure all those changes are improvements but they at least don't seem strictly worse.
@bors r+ |
📌 Commit 34c6cee has been approved by |
Rename `#[doc(spotlight)]` to `#[doc(notable_trait)]` Fixes rust-lang#80936. "spotlight" is not a very specific or self-explaining name. Additionally, the dialog that it triggers is called "Notable traits". So, "notable trait" is a better name. * Rename `#[doc(spotlight)]` to `#[doc(notable_trait)]` * Rename `#![feature(doc_spotlight)]` to `#![feature(doc_notable_trait)]` * Update documentation * Improve documentation r? `@Manishearth`
☀️ Test successful - checks-actions |
I didn't make these renames in rust-lang#80965 because I didn't want the PR to conflict with rust-lang#80914.
…ht, r=GuillaumeGomez rustdoc: Rename internal uses of `spotlight` I didn't make these renames in rust-lang#80965 because I didn't want the PR to conflict with rust-lang#80914.
Fixes #80936.
"spotlight" is not a very specific or self-explaining name.
Additionally, the dialog that it triggers is called "Notable traits".
So, "notable trait" is a better name.
#[doc(spotlight)]
to#[doc(notable_trait)]
#![feature(doc_spotlight)]
to#![feature(doc_notable_trait)]
r? @Manishearth