File tree 1 file changed +19
-0
lines changed
1 file changed +19
-0
lines changed Original file line number Diff line number Diff line change @@ -1216,6 +1216,23 @@ impl LinkCollector<'_, '_> {
1216
1216
. emit ( ) ;
1217
1217
}
1218
1218
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
+ && !self . cx . tcx . has_attr ( * def_id, sym:: rustc_doc_primitive)
1226
+ {
1227
+ false
1228
+ } else if !self . cx . render_options . document_hidden && self . cx . tcx . is_doc_hidden ( def_id) {
1229
+ false
1230
+ } else {
1231
+ true
1232
+ }
1233
+ } ) ;
1234
+ }
1235
+
1219
1236
fn resolve_with_disambiguator_cached (
1220
1237
& mut self ,
1221
1238
key : ResolutionInfo ,
@@ -1250,6 +1267,8 @@ impl LinkCollector<'_, '_> {
1250
1267
}
1251
1268
}
1252
1269
1270
+ self . filter_private_hidden_candidates ( & mut candidates) ;
1271
+
1253
1272
// If there are multiple items with the same "kind" (for example, both "associated types")
1254
1273
// and after removing duplicated kinds, only one remains, the `ambiguity_error` function
1255
1274
// 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