Skip to content

Commit ad30c39

Browse files
Pass TyCtxt directly instead of DocContext in librustdoc::visit_ast::inherits_doc_hidden
1 parent 186f139 commit ad30c39

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

src/librustdoc/passes/doc_test_lints.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ crate fn should_have_doc_example(cx: &DocContext<'_>, item: &clean::Item) -> boo
7373
}
7474
let hir_id = cx.tcx.hir().local_def_id_to_hir_id(item.def_id.expect_local());
7575
if cx.tcx.hir().attrs(hir_id).lists(sym::doc).has_word(sym::hidden)
76-
|| inherits_doc_hidden(cx, hir_id)
76+
|| inherits_doc_hidden(cx.tcx, hir_id)
7777
{
7878
return false;
7979
}

src/librustdoc/visit_ast.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,10 @@ fn def_id_to_path(tcx: TyCtxt<'_>, did: DefId) -> Vec<String> {
2929
std::iter::once(crate_name).chain(relative).collect()
3030
}
3131

32-
crate fn inherits_doc_hidden(cx: &core::DocContext<'_>, mut node: hir::HirId) -> bool {
33-
while let Some(id) = cx.tcx.hir().get_enclosing_scope(node) {
32+
crate fn inherits_doc_hidden(tcx: TyCtxt<'_>, mut node: hir::HirId) -> bool {
33+
while let Some(id) = tcx.hir().get_enclosing_scope(node) {
3434
node = id;
35-
if cx.tcx.hir().attrs(node).lists(sym::doc).has_word(sym::hidden) {
35+
if tcx.hir().attrs(node).lists(sym::doc).has_word(sym::hidden) {
3636
return true;
3737
}
3838
}
@@ -209,7 +209,7 @@ impl<'a, 'tcx> RustdocVisitor<'a, 'tcx> {
209209
};
210210

211211
let is_private = !self.cx.cache.access_levels.is_public(res_did);
212-
let is_hidden = inherits_doc_hidden(self.cx, res_hir_id);
212+
let is_hidden = inherits_doc_hidden(self.cx.tcx, res_hir_id);
213213

214214
// Only inline if requested or if the item would otherwise be stripped.
215215
if (!please_inline && !is_private && !is_hidden) || is_no_inline {

0 commit comments

Comments
 (0)