@@ -16,6 +16,7 @@ use rustc_span::Span;
1616
1717use std:: mem;
1818
19+ use crate :: clean:: utils:: { inherits_doc_hidden, should_ignore_res} ;
1920use crate :: clean:: { cfg:: Cfg , reexport_chain, AttributesExt , NestedAttributesExt } ;
2021use crate :: core;
2122
@@ -73,38 +74,6 @@ fn def_id_to_path(tcx: TyCtxt<'_>, did: DefId) -> Vec<Symbol> {
7374 std:: iter:: once ( crate_name) . chain ( relative) . collect ( )
7475}
7576
76- pub ( crate ) fn inherits_doc_hidden (
77- tcx : TyCtxt < ' _ > ,
78- mut def_id : LocalDefId ,
79- stop_at : Option < LocalDefId > ,
80- ) -> bool {
81- let hir = tcx. hir ( ) ;
82- while let Some ( id) = tcx. opt_local_parent ( def_id) {
83- if let Some ( stop_at) = stop_at && id == stop_at {
84- return false ;
85- }
86- def_id = id;
87- if tcx. is_doc_hidden ( def_id. to_def_id ( ) ) {
88- return true ;
89- } else if let Some ( node) = hir. find_by_def_id ( def_id) &&
90- matches ! (
91- node,
92- hir:: Node :: Item ( hir:: Item { kind: hir:: ItemKind :: Impl ( _) , .. } ) ,
93- )
94- {
95- // `impl` blocks stand a bit on their own: unless they have `#[doc(hidden)]` directly
96- // on them, they don't inherit it from the parent context.
97- return false ;
98- }
99- }
100- false
101- }
102-
103- #[ inline]
104- pub ( crate ) fn should_ignore_res ( res : Res ) -> bool {
105- matches ! ( res, Res :: Def ( DefKind :: Ctor ( ..) , _) | Res :: SelfCtor ( ..) )
106- }
107-
10877pub ( crate ) struct RustdocVisitor < ' a , ' tcx > {
10978 cx : & ' a mut core:: DocContext < ' tcx > ,
11079 view_item_stack : LocalDefIdSet ,
0 commit comments