File tree Expand file tree Collapse file tree 1 file changed +18
-0
lines changed Expand file tree Collapse file tree 1 file changed +18
-0
lines changed Original file line number Diff line number Diff line change @@ -1216,6 +1216,22 @@ impl LinkCollector<'_, '_> {
12161216 . emit ( ) ;
12171217 }
12181218
1219+ fn filter_private_hidden_candidates ( & self , candidates : & mut Vec < ( Res , Option < DefId > ) > ) {
1220+ candidates. retain ( |( candidate, _) | {
1221+ let Res :: Def ( _, def_id) = candidate else { return true } ;
1222+
1223+ if !self . cx . render_options . document_private
1224+ && !self . cx . tcx . visibility ( def_id) . is_public ( )
1225+ {
1226+ false
1227+ } else if !self . cx . render_options . document_hidden && self . cx . tcx . is_doc_hidden ( def_id) {
1228+ false
1229+ } else {
1230+ true
1231+ }
1232+ } ) ;
1233+ }
1234+
12191235 fn resolve_with_disambiguator_cached (
12201236 & mut self ,
12211237 key : ResolutionInfo ,
@@ -1250,6 +1266,8 @@ impl LinkCollector<'_, '_> {
12501266 }
12511267 }
12521268
1269+ self . filter_private_hidden_candidates ( & mut candidates) ;
1270+
12531271 // If there are multiple items with the same "kind" (for example, both "associated types")
12541272 // and after removing duplicated kinds, only one remains, the `ambiguity_error` function
12551273 // won't emit an error. So at this point, we can just take the first candidate as it was
You can’t perform that action at this time.
0 commit comments