-
Notifications
You must be signed in to change notification settings - Fork 13.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Auto merge of #80965 - camelid:rename-doc-spotlight, r=jyn514
Rename `#[doc(spotlight)]` to `#[doc(notable_trait)]` 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. * Rename `#[doc(spotlight)]` to `#[doc(notable_trait)]` * Rename `#![feature(doc_spotlight)]` to `#![feature(doc_notable_trait)]` * Update documentation * Improve documentation r? `@Manishearth`
- Loading branch information
Showing
23 changed files
with
153 additions
and
88 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
33 changes: 33 additions & 0 deletions
33
src/doc/unstable-book/src/language-features/doc-notable-trait.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
# `doc_notable_trait` | ||
|
||
The tracking issue for this feature is: [#45040] | ||
|
||
The `doc_notable_trait` feature allows the use of the `#[doc(notable_trait)]` | ||
attribute, which will display the trait in a "Notable traits" dialog for | ||
functions returning types that implement the trait. For example, this attribute | ||
is applied to the `Iterator`, `Future`, `io::Read`, and `io::Write` traits in | ||
the standard library. | ||
|
||
You can do this on your own traits like so: | ||
|
||
``` | ||
#![feature(doc_notable_trait)] | ||
#[doc(notable_trait)] | ||
pub trait MyTrait {} | ||
pub struct MyStruct; | ||
impl MyTrait for MyStruct {} | ||
/// The docs for this function will have a button that displays a dialog about | ||
/// `MyStruct` implementing `MyTrait`. | ||
pub fn my_fn() -> MyStruct { MyStruct } | ||
``` | ||
|
||
This feature was originally implemented in PR [#45039]. | ||
|
||
See also its documentation in [the rustdoc book][rustdoc-book-notable_trait]. | ||
|
||
[#45040]: https://github.com/rust-lang/rust/issues/45040 | ||
[#45039]: https://github.com/rust-lang/rust/pull/45039 | ||
[rustdoc-book-notable_trait]: ../../rustdoc/unstable-features.html#adding-your-trait-to-the-notable-traits-dialog |
30 changes: 0 additions & 30 deletions
30
src/doc/unstable-book/src/language-features/doc-spotlight.md
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
// ignore-tidy-linelength | ||
// check-pass | ||
// run-rustfix | ||
|
||
#![feature(doc_notable_trait)] | ||
|
||
#[doc(notable_trait)] | ||
//~^ WARN unknown `doc` attribute `spotlight` | ||
//~| WARN this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! | ||
trait MyTrait {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
// ignore-tidy-linelength | ||
// check-pass | ||
// run-rustfix | ||
|
||
#![feature(doc_notable_trait)] | ||
|
||
#[doc(spotlight)] | ||
//~^ WARN unknown `doc` attribute `spotlight` | ||
//~| WARN this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! | ||
trait MyTrait {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
warning: unknown `doc` attribute `spotlight` | ||
--> $DIR/doc-spotlight.rs:7:7 | ||
| | ||
LL | #[doc(spotlight)] | ||
| ^^^^^^^^^ help: use `notable_trait` instead | ||
| | ||
= note: `#[warn(invalid_doc_attributes)]` on by default | ||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! | ||
= note: for more information, see issue #82730 <https://github.com/rust-lang/rust/issues/82730> | ||
= note: `doc(spotlight)` was renamed to `doc(notable_trait)` | ||
= note: `doc(spotlight)` is now a no-op | ||
|
||
warning: 1 warning emitted | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
#[doc(notable_trait)] //~ ERROR: `#[doc(notable_trait)]` is experimental | ||
trait SomeTrait {} | ||
|
||
fn main() {} |
12 changes: 12 additions & 0 deletions
12
src/test/ui/feature-gates/feature-gate-doc_notable_trait.stderr
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
error[E0658]: `#[doc(notable_trait)]` is experimental | ||
--> $DIR/feature-gate-doc_notable_trait.rs:1:1 | ||
| | ||
LL | #[doc(notable_trait)] | ||
| ^^^^^^^^^^^^^^^^^^^^^ | ||
| | ||
= note: see issue #45040 <https://github.com/rust-lang/rust/issues/45040> for more information | ||
= help: add `#![feature(doc_notable_trait)]` to the crate attributes to enable | ||
|
||
error: aborting due to previous error | ||
|
||
For more information about this error, try `rustc --explain E0658`. |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.