Auto merge of #107136 - petrochenkov:dochidden, r=cjgillot
rustc_metadata: Encode `doc(hidden)` flag to metadata To retrieve these flags rustdoc currently has to mass decode full attributes for items in the whole crate tree, so it's better to pre-compute it in advance. This is especially important for short-term performance of https://github.com/rust-lang/rust/pull/107054 because resolver cannot use memoization of query results yet.
This commit is contained in:
commit
5bef91c6e9
10 changed files with 52 additions and 18 deletions
|
@ -1157,6 +1157,7 @@ rustc_queries! {
|
|||
/// Determines whether an item is annotated with `doc(hidden)`.
|
||||
query is_doc_hidden(def_id: DefId) -> bool {
|
||||
desc { |tcx| "checking whether `{}` is `doc(hidden)`", tcx.def_path_str(def_id) }
|
||||
separate_provide_extern
|
||||
}
|
||||
|
||||
/// Determines whether an item is annotated with `doc(notable_trait)`.
|
||||
|
|
|
@ -1310,7 +1310,8 @@ pub fn reveal_opaque_types_in_bounds<'tcx>(
|
|||
}
|
||||
|
||||
/// Determines whether an item is annotated with `doc(hidden)`.
|
||||
pub fn is_doc_hidden(tcx: TyCtxt<'_>, def_id: DefId) -> bool {
|
||||
fn is_doc_hidden(tcx: TyCtxt<'_>, def_id: DefId) -> bool {
|
||||
assert!(def_id.is_local());
|
||||
tcx.get_attrs(def_id, sym::doc)
|
||||
.filter_map(|attr| attr.meta_item_list())
|
||||
.any(|items| items.iter().any(|item| item.has_name(sym::hidden)))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue