@@ -118,6 +118,10 @@ impl<'ra> EarlyDocLinkResolver<'_, 'ra> {
118
118
}
119
119
}
120
120
121
+ fn is_doc_reachable ( & self , def_id : DefId ) -> bool {
122
+ self . extern_doc_reachable . contains ( & def_id) || self . local_doc_reachable . contains ( & def_id)
123
+ }
124
+
121
125
/// Add traits in scope for links in impls collected by the `collect-intra-doc-links` pass.
122
126
/// That pass filters impls using type-based information, but we don't yet have such
123
127
/// information here, so we just conservatively calculate traits in scope for *all* modules
@@ -148,10 +152,10 @@ impl<'ra> EarlyDocLinkResolver<'_, 'ra> {
148
152
// privacy, private traits and impls from other crates are never documented in
149
153
// the current crate, and links in their doc comments are not resolved.
150
154
for & ( trait_def_id, impl_def_id, simplified_self_ty) in & all_trait_impls {
151
- if self . resolver . cstore ( ) . visibility_untracked ( trait_def_id) . is_public ( )
152
- && simplified_self_ty. and_then ( |ty| ty . def ( ) ) . map_or ( true , |ty_def_id| {
153
- self . resolver . cstore ( ) . visibility_untracked ( ty_def_id ) . is_public ( )
154
- } )
155
+ if self . is_doc_reachable ( trait_def_id)
156
+ && simplified_self_ty
157
+ . and_then ( |ty| ty . def ( ) )
158
+ . map_or ( true , |ty_def_id| self . is_doc_reachable ( ty_def_id ) )
155
159
{
156
160
if self . visited_mods . insert ( trait_def_id) {
157
161
self . resolve_doc_links_extern_impl ( trait_def_id, false ) ;
@@ -160,7 +164,7 @@ impl<'ra> EarlyDocLinkResolver<'_, 'ra> {
160
164
}
161
165
}
162
166
for ( ty_def_id, impl_def_id) in all_inherent_impls {
163
- if self . resolver . cstore ( ) . visibility_untracked ( ty_def_id) . is_public ( ) {
167
+ if self . is_doc_reachable ( ty_def_id) {
164
168
self . resolve_doc_links_extern_impl ( impl_def_id, true ) ;
165
169
}
166
170
}
0 commit comments