use rustc_hir::def::{DefKind, Res};
use rustc_hir::def_id::DefId;
use rustc_hir::Node;
+use rustc_hir::CRATE_HIR_ID;
use rustc_middle::middle::privacy::AccessLevel;
use rustc_middle::ty::TyCtxt;
use rustc_span;
use std::mem;
-use crate::clean::{self, AttributesExt, NestedAttributesExt};
+use crate::clean::{self, cfg::Cfg, AttributesExt, NestedAttributesExt};
use crate::core;
use crate::doctree::*;
}
}
}
+
+ self.cx.cache.hidden_cfg = self
+ .cx
+ .tcx
+ .hir()
+ .attrs(CRATE_HIR_ID)
+ .iter()
+ .filter(|attr| attr.has_name(sym::doc))
+ .flat_map(|attr| attr.meta_item_list().into_iter().flatten())
+ .filter(|attr| attr.has_name(sym::cfg_hide))
+ .flat_map(|attr| {
+ attr.meta_item_list()
+ .unwrap_or(&[])
+ .iter()
+ .filter_map(|attr| {
+ Some(
+ Cfg::parse(attr.meta_item()?)
+ .map_err(|e| self.cx.sess().diagnostic().span_err(e.span, e.msg))
+ .ok()?,
+ )
+ })
+ .collect::<Vec<_>>()
+ })
+ .collect();
+
self.cx.cache.exact_paths = self.exact_paths;
top_level_module
}