Pass TyCtxt directly instead of DocContext in librustdoc::visit_ast::inherits_doc_hidden
This commit is contained in:
parent
186f13914a
commit
ad30c39918
2 changed files with 5 additions and 5 deletions
|
@ -73,7 +73,7 @@ crate fn should_have_doc_example(cx: &DocContext<'_>, item: &clean::Item) -> boo
|
||||||
}
|
}
|
||||||
let hir_id = cx.tcx.hir().local_def_id_to_hir_id(item.def_id.expect_local());
|
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)
|
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;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,10 +29,10 @@ fn def_id_to_path(tcx: TyCtxt<'_>, did: DefId) -> Vec<String> {
|
||||||
std::iter::once(crate_name).chain(relative).collect()
|
std::iter::once(crate_name).chain(relative).collect()
|
||||||
}
|
}
|
||||||
|
|
||||||
crate fn inherits_doc_hidden(cx: &core::DocContext<'_>, mut node: hir::HirId) -> bool {
|
crate fn inherits_doc_hidden(tcx: TyCtxt<'_>, mut node: hir::HirId) -> bool {
|
||||||
while let Some(id) = cx.tcx.hir().get_enclosing_scope(node) {
|
while let Some(id) = tcx.hir().get_enclosing_scope(node) {
|
||||||
node = id;
|
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;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -209,7 +209,7 @@ impl<'a, 'tcx> RustdocVisitor<'a, 'tcx> {
|
||||||
};
|
};
|
||||||
|
|
||||||
let is_private = !self.cx.cache.access_levels.is_public(res_did);
|
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.
|
// Only inline if requested or if the item would otherwise be stripped.
|
||||||
if (!please_inline && !is_private && !is_hidden) || is_no_inline {
|
if (!please_inline && !is_private && !is_hidden) || is_no_inline {
|
||||||
|
|
Loading…
Reference in a new issue