cfg_hide => doc_cfg_hide
masked => doc_masked
notable_trait => doc_notable_trait
- keyword => doc_keyword
);
+
+ if nested_meta.has_name(sym::keyword) {
+ let msg = "`#[doc(keyword)]` is meant for internal use only";
+ gate_feature_post!(self, rustdoc_internals, attr.span, msg);
+ }
}
}
(active, rustc_allow_const_fn_unstable, "1.49.0", Some(69399), None),
/// Allows using compiler's own crates.
(active, rustc_private, "1.0.0", Some(27812), None),
+ /// Allows using internal rustdoc features like `doc(primitive)` or `doc(keyword)`.
+ (active, rustdoc_internals, "1.58.0", Some(90418), None),
/// Allows using `#[start]` on a function indicating that it is the program entrypoint.
(active, start, "1.0.0", Some(29633), None),
/// Allows using `#[structural_match]` which indicates that a type is structurally matchable.
(active, doc_cfg, "1.21.0", Some(43781), None),
/// Allows `#[doc(cfg_hide(...))]`.
(active, doc_cfg_hide, "1.57.0", Some(43781), None),
- /// Allows using `#[doc(keyword = "...")]`.
- (active, doc_keyword, "1.28.0", Some(51315), None),
/// Allows `#[doc(masked)]`.
(active, doc_masked, "1.21.0", Some(44027), None),
- /// Allows using doc(primitive) without a future-incompat warning
- (active, doc_primitive, "1.56.0", Some(88070), None),
/// Allows `X..Y` patterns.
(active, exclusive_range_pattern, "1.11.0", Some(37854), None),
/// Allows exhaustive pattern matching on types that contain uninhabited types.
/// Allows the use of `#[derive(Anything)]` as sugar for `#[derive_Anything]`.
(removed, custom_derive, "1.32.0", Some(29644), None,
Some("subsumed by `#[proc_macro_derive]`")),
+ /// Allows using `#[doc(keyword = "...")]`.
+ (removed, doc_keyword, "1.28.0", Some(51315), None,
+ Some("merged into `#![feature(rustdoc_internals)]`")),
+ /// Allows using `doc(primitive)` without a future-incompat warning.
+ (removed, doc_primitive, "1.56.0", Some(88070), None,
+ Some("merged into `#![feature(rustdoc_internals)]`")),
/// Allows `#[doc(spotlight)]`.
/// The attribute was renamed to `#[doc(notable_trait)]`
/// and the feature to `doc_notable_trait`.
}
sym::primitive => {
- if !self.tcx.features().doc_primitive {
+ if !self.tcx.features().rustdoc_internals {
self.tcx.struct_span_lint_hir(
INVALID_DOC_ATTRIBUTES,
hir_id,
rustc_unsafe_specialization_marker,
rustc_variance,
rustdoc,
+ rustdoc_internals,
rustfmt,
rvalue_static_promotion,
s,
#![feature(derive_default_enum)]
#![feature(doc_cfg)]
#![feature(doc_notable_trait)]
-#![feature(doc_primitive)]
+#![cfg_attr(bootstrap, feature(doc_primitive))]
+#![cfg_attr(not(bootstrap), feature(rustdoc_internals))]
#![feature(exhaustive_patterns)]
#![feature(doc_cfg_hide)]
#![feature(extern_types)]
#![feature(decl_macro)]
#![feature(doc_cfg)]
#![feature(doc_cfg_hide)]
-#![feature(doc_keyword)]
+#![cfg_attr(bootstrap, feature(doc_primitive))]
+#![cfg_attr(bootstrap, feature(doc_keyword))]
+#![cfg_attr(not(bootstrap), feature(rustdoc_internals))]
#![feature(doc_masked)]
#![feature(doc_notable_trait)]
-#![feature(doc_primitive)]
#![feature(dropck_eyepatch)]
#![feature(duration_checked_float)]
#![feature(duration_constants)]
Since primitive types are defined in the compiler, there's no place to attach documentation
attributes. The `#[doc(primitive)]` attribute is used by the standard library to provide a way
-to generate documentation for primitive types, and requires `#![feature(doc_primitive)]` to enable.
+to generate documentation for primitive types, and requires `#![feature(rustdoc_internals)]` to
+enable.
## Document keywords
To do so, the `#[doc(keyword = "...")]` attribute is used. Example:
```rust
-#![feature(doc_keyword)]
+#![feature(rustdoc_internals)]
/// Some documentation about the keyword.
#[doc(keyword = "keyword")]
//! documentation generated so we can test each different features.
#![crate_name = "test_docs"]
-#![feature(doc_keyword)]
+#![feature(rustdoc_internals)]
#![feature(doc_cfg)]
use std::convert::AsRef;
// edition:2018
-#![feature(doc_primitive)]
+#![feature(rustdoc_internals)]
#[doc(primitive = "usize")]
mod usize {}
// compile-flags:-Z unstable-options --show-coverage
// check-pass
-#![feature(doc_keyword)]
-#![feature(doc_primitive)]
+#![feature(rustdoc_internals)]
//! the features only used in std also have entries in the table, so make sure those get pulled out
//! properly as well
-#![feature(doc_keyword)]
+#![feature(rustdoc_internals)]
#[doc(keyword = "foo df")] //~ ERROR
mod foo {}
#![crate_name = "foo"]
-#![feature(doc_keyword)]
+#![feature(rustdoc_internals)]
// @has foo/index.html '//h2[@id="keywords"]' 'Keywords'
// @has foo/index.html '//a[@href="keyword.match.html"]' 'match'
#![crate_name = "foo"]
-#![feature(doc_keyword)]
+#![feature(rustdoc_internals)]
// tests for the html <title> element
// compile-flags: -Z unstable-options
#![feature(rustc_private)]
-#![feature(doc_keyword)]
+#![feature(rustdoc_internals)]
#![crate_type = "lib"]
+++ /dev/null
-#[doc(keyword = "match")] //~ ERROR: `#[doc(keyword)]` is experimental
-/// wonderful
-mod foo{}
-
-fn main() {}
+++ /dev/null
-error[E0658]: `#[doc(keyword)]` is experimental
- --> $DIR/feature-gate-doc_keyword.rs:1:1
- |
-LL | #[doc(keyword = "match")]
- | ^^^^^^^^^^^^^^^^^^^^^^^^^
- |
- = note: see issue #51315 <https://github.com/rust-lang/rust/issues/51315> for more information
- = help: add `#![feature(doc_keyword)]` to the crate attributes to enable
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0658`.
--- /dev/null
+#[doc(keyword = "match")] //~ ERROR: `#[doc(keyword)]` is meant for internal use only
+/// wonderful
+mod foo {}
+
+fn main() {}
--- /dev/null
+error[E0658]: `#[doc(keyword)]` is meant for internal use only
+ --> $DIR/feature-gate-rustdoc_internals.rs:1:1
+ |
+LL | #[doc(keyword = "match")]
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = note: see issue #90418 <https://github.com/rust-lang/rust/issues/90418> for more information
+ = help: add `#![feature(rustdoc_internals)]` to the crate attributes to enable
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0658`.
#![crate_type = "lib"]
-#![feature(doc_keyword)]
+#![feature(rustdoc_internals)]
#![doc(keyword = "hello")] //~ ERROR
--- /dev/null
+#![feature(doc_keyword)] //~ ERROR
+#![feature(doc_primitive)] //~ ERROR
+#![crate_type = "lib"]
+
+pub fn foo() {}
--- /dev/null
+error[E0557]: feature has been removed
+ --> $DIR/renamed-features-rustdoc_internals.rs:1:12
+ |
+LL | #![feature(doc_keyword)]
+ | ^^^^^^^^^^^ feature has been removed
+ |
+ = note: merged into `#![feature(rustdoc_internals)]`
+
+error[E0557]: feature has been removed
+ --> $DIR/renamed-features-rustdoc_internals.rs:2:12
+ |
+LL | #![feature(doc_primitive)]
+ | ^^^^^^^^^^^^^ feature has been removed
+ |
+ = note: merged into `#![feature(rustdoc_internals)]`
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0557`.