diff options
| author | clubby789 <jamie@hill-daniel.co.uk> | 2025-03-09 23:42:48 +0000 |
|---|---|---|
| committer | clubby789 <jamie@hill-daniel.co.uk> | 2025-03-10 14:18:56 +0000 |
| commit | 28bd22c3d9a477ff9b7b85782fb517c29b58ed88 (patch) | |
| tree | c8dc0b6546879027c1e59e5a9a28753a0f56d4c0 /src/librustdoc/clean/cfg.rs | |
| parent | 3ea711f17e3946ac3f4df11691584e2c56b4b0cf (diff) | |
| download | rust-28bd22c3d9a477ff9b7b85782fb517c29b58ed88.tar.gz rust-28bd22c3d9a477ff9b7b85782fb517c29b58ed88.zip | |
rustdoc: Gate unstable `doc(cfg())` predicates
Diffstat (limited to 'src/librustdoc/clean/cfg.rs')
| -rw-r--r-- | src/librustdoc/clean/cfg.rs | 14 |
1 files changed, 4 insertions, 10 deletions
diff --git a/src/librustdoc/clean/cfg.rs b/src/librustdoc/clean/cfg.rs index ab169f3c2a4..1541e7201ce 100644 --- a/src/librustdoc/clean/cfg.rs +++ b/src/librustdoc/clean/cfg.rs @@ -8,7 +8,6 @@ use std::{mem, ops}; use rustc_ast::{LitKind, MetaItem, MetaItemInner, MetaItemKind, MetaItemLit}; use rustc_data_structures::fx::FxHashSet; -use rustc_feature::Features; use rustc_session::parse::ParseSess; use rustc_span::Span; use rustc_span::symbol::{Symbol, sym}; @@ -132,18 +131,13 @@ impl Cfg { /// Checks whether the given configuration can be matched in the current session. /// /// Equivalent to `attr::cfg_matches`. - // FIXME: Actually make use of `features`. - pub(crate) fn matches(&self, psess: &ParseSess, features: Option<&Features>) -> bool { + pub(crate) fn matches(&self, psess: &ParseSess) -> bool { match *self { Cfg::False => false, Cfg::True => true, - Cfg::Not(ref child) => !child.matches(psess, features), - Cfg::All(ref sub_cfgs) => { - sub_cfgs.iter().all(|sub_cfg| sub_cfg.matches(psess, features)) - } - Cfg::Any(ref sub_cfgs) => { - sub_cfgs.iter().any(|sub_cfg| sub_cfg.matches(psess, features)) - } + Cfg::Not(ref child) => !child.matches(psess), + Cfg::All(ref sub_cfgs) => sub_cfgs.iter().all(|sub_cfg| sub_cfg.matches(psess)), + Cfg::Any(ref sub_cfgs) => sub_cfgs.iter().any(|sub_cfg| sub_cfg.matches(psess)), Cfg::Cfg(name, value) => psess.config.contains(&(name, value)), } } |
