1
Fork 0

Stabilize doc_alias feature

This commit is contained in:
Guillaume Gomez 2020-08-20 13:35:00 +02:00
parent b5f55b7e15
commit d069c7e928
10 changed files with 18 additions and 61 deletions

View file

@ -260,7 +260,6 @@ impl<'a> Visitor<'a> for PostExpansionVisitor<'a> {
cfg => doc_cfg cfg => doc_cfg
masked => doc_masked masked => doc_masked
spotlight => doc_spotlight spotlight => doc_spotlight
alias => doc_alias
keyword => doc_keyword keyword => doc_keyword
); );
} }

View file

@ -268,6 +268,8 @@ declare_features! (
/// Allows `#[track_caller]` to be used which provides /// Allows `#[track_caller]` to be used which provides
/// accurate caller location reporting during panic (RFC 2091). /// accurate caller location reporting during panic (RFC 2091).
(accepted, track_caller, "1.46.0", Some(47809), None), (accepted, track_caller, "1.46.0", Some(47809), None),
/// Allows `#[doc(alias = "...")]`.
(accepted, doc_alias, "1.48.0", Some(50146), None),
// ------------------------------------------------------------------------- // -------------------------------------------------------------------------
// feature-group-end: accepted features // feature-group-end: accepted features

View file

@ -404,9 +404,6 @@ declare_features! (
/// Allows dereferencing raw pointers during const eval. /// Allows dereferencing raw pointers during const eval.
(active, const_raw_ptr_deref, "1.27.0", Some(51911), None), (active, const_raw_ptr_deref, "1.27.0", Some(51911), None),
/// Allows `#[doc(alias = "...")]`.
(active, doc_alias, "1.27.0", Some(50146), None),
/// Allows inconsistent bounds in where clauses. /// Allows inconsistent bounds in where clauses.
(active, trivial_bounds, "1.28.0", Some(48214), None), (active, trivial_bounds, "1.28.0", Some(48214), None),

View file

@ -131,7 +131,7 @@
#![feature(untagged_unions)] #![feature(untagged_unions)]
#![feature(unwind_attributes)] #![feature(unwind_attributes)]
#![feature(variant_count)] #![feature(variant_count)]
#![feature(doc_alias)] #![cfg_attr(bootstrap, feature(doc_alias))]
#![feature(mmx_target_feature)] #![feature(mmx_target_feature)]
#![feature(tbm_target_feature)] #![feature(tbm_target_feature)]
#![feature(sse4a_target_feature)] #![feature(sse4a_target_feature)]

View file

@ -245,7 +245,7 @@
#![feature(core_intrinsics)] #![feature(core_intrinsics)]
#![feature(custom_test_frameworks)] #![feature(custom_test_frameworks)]
#![feature(decl_macro)] #![feature(decl_macro)]
#![feature(doc_alias)] #![cfg_attr(bootstrap, feature(doc_alias))]
#![feature(doc_cfg)] #![feature(doc_cfg)]
#![feature(doc_keyword)] #![feature(doc_keyword)]
#![feature(doc_masked)] #![feature(doc_masked)]

View file

@ -32,3 +32,17 @@ pub struct UnixToken;
Here, the respective tokens can only be used by dependent crates on their respective platforms, but Here, the respective tokens can only be used by dependent crates on their respective platforms, but
they will both appear in documentation. they will both appear in documentation.
## Add aliases for an item in documentation search
This feature allows you to add alias(es) to an item when using the `rustdoc` search through the
`doc(alias)` attribute. Example:
```rust,no_run
#[doc(alias = "x")]
#[doc(alias = "big")]
pub struct BigX;
```
Then, when looking for it through the `rustdoc` search, if you enter "x" or
"big", search will show the `BigX` struct first.

View file

@ -207,22 +207,6 @@ issue][issue-include].
[unstable-include]: ../unstable-book/language-features/external-doc.html [unstable-include]: ../unstable-book/language-features/external-doc.html
[issue-include]: https://github.com/rust-lang/rust/issues/44732 [issue-include]: https://github.com/rust-lang/rust/issues/44732
### Add aliases for an item in documentation search
This feature allows you to add alias(es) to an item when using the `rustdoc` search through the
`doc(alias)` attribute. Example:
```rust,no_run
#![feature(doc_alias)]
#[doc(alias = "x")]
#[doc(alias = "big")]
pub struct BigX;
```
Then, when looking for it through the `rustdoc` search, if you enter "x" or
"big", search will show the `BigX` struct first.
## Unstable command-line arguments ## Unstable command-line arguments
These features are enabled by passing a command-line flag to Rustdoc, but the flags in question are These features are enabled by passing a command-line flag to Rustdoc, but the flags in question are

View file

@ -1,23 +0,0 @@
# `doc_alias`
The tracking issue for this feature is: [#50146]
[#50146]: https://github.com/rust-lang/rust/issues/50146
------------------------
You can add alias(es) to an item when using the `rustdoc` search through the
`doc(alias)` attribute. Example:
```rust,no_run
#![feature(doc_alias)]
#[doc(alias = "x")]
#[doc(alias = "big")]
pub struct BigX;
```
Then, when looking for it through the `rustdoc` search, if you enter "x" or
"big", search will show the `BigX` struct first.
Note that this feature is currently hidden behind the `feature(doc_alias)` gate.

View file

@ -1,4 +0,0 @@
#[doc(alias = "foo")] //~ ERROR: `#[doc(alias)]` is experimental
pub struct Foo;
fn main() {}

View file

@ -1,12 +0,0 @@
error[E0658]: `#[doc(alias)]` is experimental
--> $DIR/feature-gate-doc_alias.rs:1:1
|
LL | #[doc(alias = "foo")]
| ^^^^^^^^^^^^^^^^^^^^^
|
= note: see issue #50146 <https://github.com/rust-lang/rust/issues/50146> for more information
= help: add `#![feature(doc_alias)]` to the crate attributes to enable
error: aborting due to previous error
For more information about this error, try `rustc --explain E0658`.