mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-25 16:24:46 +00:00
Create rustdoc_internals feature gate
This commit is contained in:
parent
e8423e6c44
commit
1e6ced3532
@ -325,8 +325,12 @@ impl<'a> Visitor<'a> for PostExpansionVisitor<'a> {
|
||||
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 = concat!("`#[doc(keyword)]` is meant for internal use only");
|
||||
gate_feature_post!(self, rustdoc_internals, attr.span, msg);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -206,6 +206,8 @@ declare_features! (
|
||||
(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.
|
||||
@ -366,12 +368,8 @@ declare_features! (
|
||||
(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.
|
||||
|
@ -76,6 +76,12 @@ declare_features! (
|
||||
/// 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`.
|
||||
|
@ -963,7 +963,7 @@ impl CheckAttrVisitor<'tcx> {
|
||||
}
|
||||
|
||||
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,
|
||||
|
@ -1154,6 +1154,7 @@ symbols! {
|
||||
rustc_unsafe_specialization_marker,
|
||||
rustc_variance,
|
||||
rustdoc,
|
||||
rustdoc_internals,
|
||||
rustfmt,
|
||||
rvalue_static_promotion,
|
||||
s,
|
||||
|
@ -165,7 +165,8 @@
|
||||
#![feature(decl_macro)]
|
||||
#![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)]
|
||||
|
@ -275,10 +275,11 @@
|
||||
#![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)]
|
||||
|
@ -138,7 +138,8 @@ This is for Rust compiler internal use only.
|
||||
|
||||
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
|
||||
|
||||
@ -149,7 +150,7 @@ Rust keywords are documented in the standard library (look for `match` for examp
|
||||
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")]
|
||||
|
@ -2,7 +2,7 @@
|
||||
//! 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;
|
||||
|
@ -1,6 +1,6 @@
|
||||
// edition:2018
|
||||
|
||||
#![feature(doc_primitive)]
|
||||
#![feature(rustdoc_internals)]
|
||||
|
||||
#[doc(primitive = "usize")]
|
||||
mod usize {}
|
||||
|
@ -1,8 +1,7 @@
|
||||
// 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
|
||||
|
@ -1,4 +1,4 @@
|
||||
#![feature(doc_keyword)]
|
||||
#![feature(rustdoc_internals)]
|
||||
|
||||
#[doc(keyword = "foo df")] //~ ERROR
|
||||
mod foo {}
|
||||
|
@ -1,6 +1,6 @@
|
||||
#![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'
|
||||
|
@ -1,5 +1,5 @@
|
||||
#![crate_name = "foo"]
|
||||
#![feature(doc_keyword)]
|
||||
#![feature(rustdoc_internals)]
|
||||
|
||||
// tests for the html <title> element
|
||||
|
||||
|
@ -1,5 +0,0 @@
|
||||
#[doc(keyword = "match")] //~ ERROR: `#[doc(keyword)]` is experimental
|
||||
/// wonderful
|
||||
mod foo{}
|
||||
|
||||
fn main() {}
|
@ -1,12 +0,0 @@
|
||||
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`.
|
@ -1,5 +1,5 @@
|
||||
#![crate_type = "lib"]
|
||||
#![feature(doc_keyword)]
|
||||
#![feature(rustdoc_internals)]
|
||||
|
||||
#![doc(keyword = "hello")] //~ ERROR
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user