File tree 3 files changed +27
-1
lines changed
compiler/rustc_resolve/src
librustdoc/passes/collect_intra_doc_links
3 files changed +27
-1
lines changed Original file line number Diff line number Diff line change @@ -1932,6 +1932,11 @@ impl<'a> Resolver<'a> {
1932
1932
}
1933
1933
}
1934
1934
1935
+ /// For rustdoc.
1936
+ pub fn get_partial_res ( & self , node_id : NodeId ) -> Option < PartialRes > {
1937
+ self . partial_res_map . get ( & node_id) . copied ( )
1938
+ }
1939
+
1935
1940
/// Retrieves the span of the given `DefId` if `DefId` is in the local crate.
1936
1941
#[ inline]
1937
1942
pub fn opt_span ( & self , def_id : DefId ) -> Option < Span > {
Original file line number Diff line number Diff line change @@ -354,7 +354,14 @@ impl Visitor<'_> for EarlyDocLinkResolver<'_, '_> {
354
354
self . parent_scope . module = old_module;
355
355
} else {
356
356
match & item. kind {
357
- ItemKind :: Impl ( box ast:: Impl { of_trait : Some ( ..) , .. } ) => {
357
+ ItemKind :: Impl ( box ast:: Impl { of_trait : Some ( trait_ref) , .. } ) => {
358
+ if let Some ( partial_res) = self . resolver . get_partial_res ( trait_ref. ref_id )
359
+ && let Some ( res) = partial_res. full_res ( )
360
+ && let Some ( trait_def_id) = res. opt_def_id ( )
361
+ && !trait_def_id. is_local ( )
362
+ && self . visited_mods . insert ( trait_def_id) {
363
+ self . resolve_doc_links_extern_impl ( trait_def_id, false ) ;
364
+ }
358
365
self . all_trait_impls . push ( self . resolver . local_def_id ( item. id ) . to_def_id ( ) ) ;
359
366
}
360
367
ItemKind :: MacroDef ( macro_def) if macro_def. macro_rules => {
Original file line number Diff line number Diff line change
1
+ // Doc links in `Trait`'s methods are resolved because it has a local impl.
2
+
3
+ // aux-build:issue-103463-aux.rs
4
+
5
+ extern crate issue_103463_aux;
6
+ use issue_103463_aux:: Trait ;
7
+
8
+ pub struct LocalType ;
9
+
10
+ impl Trait for LocalType {
11
+ fn method ( ) { }
12
+ }
13
+
14
+ fn main ( ) { }
You can’t perform that action at this time.
0 commit comments