diff options
| author | bors <bors@rust-lang.org> | 2023-01-23 10:12:57 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2023-01-23 10:12:57 +0000 |
| commit | 5bef91c6e902f3bded724713bd2a64ea50abbd25 (patch) | |
| tree | 2f51c05c1fb38c0d6554c708f74c07ebf55b99d2 /src | |
| parent | 6b3cd03fdb285781c60f5962194719fdfd46d910 (diff) | |
| parent | 415c14129b02cc3c61f294cff885cee6c589940d (diff) | |
| download | rust-5bef91c6e902f3bded724713bd2a64ea50abbd25.tar.gz rust-5bef91c6e902f3bded724713bd2a64ea50abbd25.zip | |
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.
Diffstat (limited to 'src')
| -rw-r--r-- | src/librustdoc/clean/types.rs | 9 |
1 files changed, 1 insertions, 8 deletions
diff --git a/src/librustdoc/clean/types.rs b/src/librustdoc/clean/types.rs index 87de41fde63..a020ccd53b8 100644 --- a/src/librustdoc/clean/types.rs +++ b/src/librustdoc/clean/types.rs @@ -2498,14 +2498,7 @@ impl Import { } pub(crate) fn imported_item_is_doc_hidden(&self, tcx: TyCtxt<'_>) -> bool { - match self.source.did { - Some(did) => tcx - .get_attrs(did, sym::doc) - .filter_map(ast::Attribute::meta_item_list) - .flatten() - .has_word(sym::hidden), - None => false, - } + self.source.did.map_or(false, |did| tcx.is_doc_hidden(did)) } } |
