Add test case for doc_cfg_hide feature gate

This commit is contained in:
Joshua Nelson 2021-02-23 22:32:33 -05:00 committed by Guillaume Gomez
parent 0031ce3a91
commit e36a370f08
3 changed files with 24 additions and 3 deletions

View file

@ -380,9 +380,6 @@ declare_features! (
/// Allows `#[doc(cfg(...))]`.
(active, doc_cfg, "1.21.0", Some(43781), None),
/// Allows `#[doc(cfg_hide(...))]`.
(active, doc_cfg_hide, "1.49.0", Some(43781), None),
/// Allows `#[doc(masked)]`.
(active, doc_masked, "1.21.0", Some(44027), None),
@ -678,6 +675,9 @@ declare_features! (
/// Allows `#[track_caller]` on closures and generators.
(active, closure_track_caller, "1.57.0", Some(87417), None),
/// Allows `#[doc(cfg_hide(...))]`.
(active, doc_cfg_hide, "1.53.0", Some(43781), None),
// -------------------------------------------------------------------------
// feature-group-end: actual feature gates
// -------------------------------------------------------------------------

View file

@ -0,0 +1,7 @@
#![doc(cfg_hide(test))]
//~^ ERROR `#[doc(cfg_hide)]` is experimental
#[cfg(not(test))]
pub fn public_fn() {}
#[cfg(test)]
pub fn internal_use_only() {}

View file

@ -0,0 +1,14 @@
error[E0658]: `#[doc(cfg_hide)]` is experimental
--> $DIR/feature-gate-doc_cfg_hide.rs:1:1
|
LL | #![doc(cfg_hide(test))]
| ^^^^^^^^^^^^^^^^^^^^^^^
|
= note: see issue #43781 <https://github.com/rust-lang/rust/issues/43781> for more information
= help: add `#![feature(doc_cfg_hide)]` to the crate attributes to enable
error: Compilation failed, aborting rustdoc
error: aborting due to 2 previous errors
For more information about this error, try `rustc --explain E0658`.