File tree 1 file changed +20
-0
lines changed
1 file changed +20
-0
lines changed Original file line number Diff line number Diff line change @@ -1227,6 +1227,24 @@ impl LinkCollector<'_, '_> {
1227
1227
. emit ( ) ;
1228
1228
}
1229
1229
1230
+ fn filter_private_hidden_candidates ( & self , candidates : & mut Vec < ( Res , Option < DefId > ) > ) {
1231
+ candidates. retain ( |( candidate, _) | {
1232
+ let Res :: Def ( _, def_id) = candidate else { return true } ;
1233
+
1234
+ if !self . cx . render_options . document_private
1235
+ && let visibility = self . cx . tcx . visibility ( def_id)
1236
+ && !visibility. is_public ( )
1237
+ && !self . cx . tcx . has_attr ( * def_id, sym:: rustc_doc_primitive)
1238
+ {
1239
+ false
1240
+ } else if !self . cx . render_options . document_hidden && self . cx . tcx . is_doc_hidden ( def_id) {
1241
+ false
1242
+ } else {
1243
+ true
1244
+ }
1245
+ } ) ;
1246
+ }
1247
+
1230
1248
fn resolve_with_disambiguator_cached (
1231
1249
& mut self ,
1232
1250
key : ResolutionInfo ,
@@ -1261,6 +1279,8 @@ impl LinkCollector<'_, '_> {
1261
1279
}
1262
1280
}
1263
1281
1282
+ self . filter_private_hidden_candidates ( & mut candidates) ;
1283
+
1264
1284
// If there are multiple items with the same "kind" (for example, both "associated types")
1265
1285
// and after removing duplicated kinds, only one remains, the `ambiguity_error` function
1266
1286
// 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