diff options
| author | Mazdak Farrokhzad <twingoow@gmail.com> | 2019-07-07 17:00:18 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2019-07-07 17:00:18 +0200 |
| commit | fe807fcf3e8c76fc54c19a1bb0570579a4ecfe95 (patch) | |
| tree | 2d5ad6ab6c856ef8f112b5e957cd0f323829f807 /src/libsyntax | |
| parent | 3250b8ee596afc9881aee092279efaa57486d2ea (diff) | |
| parent | cff6ce667fd8c5002f789a55f75ba70b67be42f7 (diff) | |
| download | rust-fe807fcf3e8c76fc54c19a1bb0570579a4ecfe95.tar.gz rust-fe807fcf3e8c76fc54c19a1bb0570579a4ecfe95.zip | |
Rollup merge of #62213 - QuietMisdreavus:cfg-doctest, r=GuillaumeGomez
rustdoc: set cfg(doctest) when collecting doctests Note: This PR builds on top of https://github.com/rust-lang/rust/pull/61199; only the last commit is specific to this PR. As discussed in https://github.com/rust-lang/rust/pull/61199, we want the ability to isolate items to only when rustdoc is collecting doctests, but we can't use `cfg(test)` because of libcore's `#![cfg(not(test))]`. This PR proposes a new cfg flag, `cfg(doctest)`, specific to this situation, rather than reusing an existing flag. I've isolated it behind a feature gate so that we can contain the effects to nightly only. (A stable workaround that can be used in lieu of `#[cfg(doctest)]` is `#[cfg(rustdoc)] #[doc(hidden)]`, at least once https://github.com/rust-lang/rust/pull/61351 lands.) Tracking issue: https://github.com/rust-lang/rust/issues/62210
Diffstat (limited to 'src/libsyntax')
| -rw-r--r-- | src/libsyntax/feature_gate.rs | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/libsyntax/feature_gate.rs b/src/libsyntax/feature_gate.rs index f4f0d041e64..fd1cb3d803b 100644 --- a/src/libsyntax/feature_gate.rs +++ b/src/libsyntax/feature_gate.rs @@ -577,6 +577,9 @@ declare_features! ( // Allows `async || body` closures. (active, async_closure, "1.37.0", Some(62290), None), + // Allows the use of `#[cfg(doctest)]`, set when rustdoc is collecting doctests + (active, cfg_doctest, "1.37.0", Some(62210), None), + // ------------------------------------------------------------------------- // feature-group-end: actual feature gates // ------------------------------------------------------------------------- @@ -1592,6 +1595,7 @@ const GATED_CFGS: &[(Symbol, Symbol, fn(&Features) -> bool)] = &[ (sym::target_thread_local, sym::cfg_target_thread_local, cfg_fn!(cfg_target_thread_local)), (sym::target_has_atomic, sym::cfg_target_has_atomic, cfg_fn!(cfg_target_has_atomic)), (sym::rustdoc, sym::doc_cfg, cfg_fn!(doc_cfg)), + (sym::doctest, sym::cfg_doctest, cfg_fn!(cfg_doctest)), ]; #[derive(Debug)] |
