Pass TyCtxt directly instead of DocContext in librustdoc::visit_ast::inherits_doc_hidden

This commit is contained in:
Guillaume Gomez
2021-02-23 15:19:13 +01:00
parent 186f13914a
commit ad30c39918
2 changed files with 5 additions and 5 deletions
+1 -1
View File
@@ -73,7 +73,7 @@ fn add_test(&mut self, _: String, config: LangString, _: usize) {
}
let hir_id = cx.tcx.hir().local_def_id_to_hir_id(item.def_id.expect_local());
if cx.tcx.hir().attrs(hir_id).lists(sym::doc).has_word(sym::hidden)
|| inherits_doc_hidden(cx, hir_id)
|| inherits_doc_hidden(cx.tcx, hir_id)
{
return false;
}
+4 -4
View File
@@ -29,10 +29,10 @@ fn def_id_to_path(tcx: TyCtxt<'_>, did: DefId) -> Vec<String> {
std::iter::once(crate_name).chain(relative).collect()
}
crate fn inherits_doc_hidden(cx: &core::DocContext<'_>, mut node: hir::HirId) -> bool {
while let Some(id) = cx.tcx.hir().get_enclosing_scope(node) {
crate fn inherits_doc_hidden(tcx: TyCtxt<'_>, mut node: hir::HirId) -> bool {
while let Some(id) = tcx.hir().get_enclosing_scope(node) {
node = id;
if cx.tcx.hir().attrs(node).lists(sym::doc).has_word(sym::hidden) {
if tcx.hir().attrs(node).lists(sym::doc).has_word(sym::hidden) {
return true;
}
}
@@ -209,7 +209,7 @@ fn maybe_inline_local(
};
let is_private = !self.cx.cache.access_levels.is_public(res_did);
let is_hidden = inherits_doc_hidden(self.cx, res_hir_id);
let is_hidden = inherits_doc_hidden(self.cx.tcx, res_hir_id);
// Only inline if requested or if the item would otherwise be stripped.
if (!please_inline && !is_private && !is_hidden) || is_no_inline {