From 95f9be04b530c0ea162cea7fb2b05a2d546e4a3c Mon Sep 17 00:00:00 2001 From: Guillaume Gomez Date: Sat, 3 Aug 2019 13:52:20 +0200 Subject: [PATCH] stabilize #[doc_alias = "..."] --- src/doc/rustdoc/src/the-doc-attribute.md | 14 +++++++++++ src/doc/rustdoc/src/unstable-features.md | 16 ------------- .../src/language-features/doc-alias.md | 23 ------------------- src/libcore/lib.rs | 1 - src/libstd/lib.rs | 1 - src/libsyntax/feature_gate.rs | 9 ++------ .../feature-gates/feature-gate-doc_alias.rs | 4 ---- .../feature-gate-doc_alias.stderr | 12 ---------- 8 files changed, 16 insertions(+), 64 deletions(-) delete mode 100644 src/doc/unstable-book/src/language-features/doc-alias.md delete mode 100644 src/test/ui/feature-gates/feature-gate-doc_alias.rs delete mode 100644 src/test/ui/feature-gates/feature-gate-doc_alias.stderr diff --git a/src/doc/rustdoc/src/the-doc-attribute.md b/src/doc/rustdoc/src/the-doc-attribute.md index 80ac405eb2f2a..42fb15d3dc824 100644 --- a/src/doc/rustdoc/src/the-doc-attribute.md +++ b/src/doc/rustdoc/src/the-doc-attribute.md @@ -214,3 +214,17 @@ the `strip-hidden` pass is removed. Since primitive types are defined in the compiler, there's no place to attach documentation attributes. This attribute is used by the standard library to provide a way to generate documentation for primitive types. + +## `#[doc(alias)]`: 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. diff --git a/src/doc/rustdoc/src/unstable-features.md b/src/doc/rustdoc/src/unstable-features.md index 6e32468b64dee..c7cdbd19ffcff 100644 --- a/src/doc/rustdoc/src/unstable-features.md +++ b/src/doc/rustdoc/src/unstable-features.md @@ -195,22 +195,6 @@ issue][issue-include]. [unstable-include]: ../unstable-book/language-features/external-doc.html [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. - ### Include items only when collecting doctests Rustdoc's [documentation tests] can do some things that regular unit tests can't, so it can diff --git a/src/doc/unstable-book/src/language-features/doc-alias.md b/src/doc/unstable-book/src/language-features/doc-alias.md deleted file mode 100644 index 647ac0cf663fd..0000000000000 --- a/src/doc/unstable-book/src/language-features/doc-alias.md +++ /dev/null @@ -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. diff --git a/src/libcore/lib.rs b/src/libcore/lib.rs index 4d627383fd7cc..567d4d00c268c 100644 --- a/src/libcore/lib.rs +++ b/src/libcore/lib.rs @@ -106,7 +106,6 @@ #![feature(unsized_locals)] #![feature(untagged_unions)] #![feature(unwind_attributes)] -#![feature(doc_alias)] #![feature(mmx_target_feature)] #![feature(tbm_target_feature)] #![feature(sse4a_target_feature)] diff --git a/src/libstd/lib.rs b/src/libstd/lib.rs index cfee49a7b555c..e50177e70eb8f 100644 --- a/src/libstd/lib.rs +++ b/src/libstd/lib.rs @@ -252,7 +252,6 @@ #![feature(const_raw_ptr_deref)] #![feature(core_intrinsics)] #![feature(custom_test_frameworks)] -#![feature(doc_alias)] #![feature(doc_cfg)] #![feature(doc_keyword)] #![feature(doc_masked)] diff --git a/src/libsyntax/feature_gate.rs b/src/libsyntax/feature_gate.rs index 33d10b269e1e3..8505b4996eb2a 100644 --- a/src/libsyntax/feature_gate.rs +++ b/src/libsyntax/feature_gate.rs @@ -450,9 +450,6 @@ declare_features! ( // Allows comparing raw pointers during const eval. (active, const_compare_raw_pointers, "1.27.0", Some(53020), None), - // Allows `#[doc(alias = "...")]`. - (active, doc_alias, "1.27.0", Some(50146), None), - // Allows inconsistent bounds in where clauses. (active, trivial_bounds, "1.28.0", Some(48214), None), @@ -854,6 +851,8 @@ declare_features! ( (accepted, repr_align_enum, "1.37.0", Some(57996), None), // Allows `const _: TYPE = VALUE`. (accepted, underscore_const_names, "1.37.0", Some(54912), None), + // Allows `#[doc(alias = "...")]`. + (accepted, doc_alias, "1.27.0", Some(50146), None), // ------------------------------------------------------------------------- // feature-group-end: accepted features @@ -1887,10 +1886,6 @@ impl<'a> Visitor<'a> for PostExpansionVisitor<'a> { gate_feature_post!(&self, doc_spotlight, attr.span, "`#[doc(spotlight)]` is experimental" ); - } else if content.iter().any(|c| c.check_name(sym::alias)) { - gate_feature_post!(&self, doc_alias, attr.span, - "`#[doc(alias = \"...\")]` is experimental" - ); } else if content.iter().any(|c| c.check_name(sym::keyword)) { gate_feature_post!(&self, doc_keyword, attr.span, "`#[doc(keyword = \"...\")]` is experimental" diff --git a/src/test/ui/feature-gates/feature-gate-doc_alias.rs b/src/test/ui/feature-gates/feature-gate-doc_alias.rs deleted file mode 100644 index adb6fc217a329..0000000000000 --- a/src/test/ui/feature-gates/feature-gate-doc_alias.rs +++ /dev/null @@ -1,4 +0,0 @@ -#[doc(alias = "foo")] //~ ERROR: `#[doc(alias = "...")]` is experimental -pub struct Foo; - -fn main() {} diff --git a/src/test/ui/feature-gates/feature-gate-doc_alias.stderr b/src/test/ui/feature-gates/feature-gate-doc_alias.stderr deleted file mode 100644 index dddaa45de8ff8..0000000000000 --- a/src/test/ui/feature-gates/feature-gate-doc_alias.stderr +++ /dev/null @@ -1,12 +0,0 @@ -error[E0658]: `#[doc(alias = "...")]` is experimental - --> $DIR/feature-gate-doc_alias.rs:1:1 - | -LL | #[doc(alias = "foo")] - | ^^^^^^^^^^^^^^^^^^^^^ - | - = note: for more information, see https://github.com/rust-lang/rust/issues/50146 - = 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`.