File tree Expand file tree Collapse file tree 3 files changed +57
-1
lines changed
librustdoc/passes/collect_intra_doc_links
test/rustdoc-ui/intra-doc Expand file tree Collapse file tree 3 files changed +57
-1
lines changed Original file line number Diff line number Diff line change @@ -260,10 +260,22 @@ impl EarlyDocLinkResolver<'_, '_> {
260260 if let Res :: Def ( DefKind :: Mod , ..) = child. res {
261261 self . resolve_doc_links_extern_inner ( def_id) ; // Inner attribute scope
262262 }
263- // Traits are processed in `add_extern_traits_in_scope `.
263+ // `DefKind::Trait`s are processed in `process_extern_impls `.
264264 if let Res :: Def ( DefKind :: Mod | DefKind :: Enum , ..) = child. res {
265265 self . process_module_children_or_reexports ( def_id) ;
266266 }
267+ if let Res :: Def ( DefKind :: Struct | DefKind :: Union | DefKind :: Variant , _) =
268+ child. res
269+ {
270+ let field_def_ids = Vec :: from_iter (
271+ self . resolver
272+ . cstore ( )
273+ . associated_item_def_ids_untracked ( def_id, self . sess ) ,
274+ ) ;
275+ for field_def_id in field_def_ids {
276+ self . resolve_doc_links_extern_outer ( field_def_id, scope_id) ;
277+ }
278+ }
267279 }
268280 }
269281 }
Original file line number Diff line number Diff line change 1+ // Traits in scope are collected for doc links in field attributes.
2+
3+ // check-pass
4+ // aux-build: assoc-field-dep.rs
5+
6+ extern crate assoc_field_dep;
7+ pub use assoc_field_dep:: * ;
8+
9+ #[ derive( Clone ) ]
10+ pub struct Struct ;
11+
12+ pub mod mod1 {
13+ pub struct Fields {
14+ /// [crate::Struct::clone]
15+ pub field : u8 ,
16+ }
17+ }
18+
19+ pub mod mod2 {
20+ pub enum Fields {
21+ V {
22+ /// [crate::Struct::clone]
23+ field : u8 ,
24+ } ,
25+ }
26+ }
Original file line number Diff line number Diff line change 1+ #[ derive( Clone ) ]
2+ pub struct Struct ;
3+
4+ pub mod dep_mod1 {
5+ pub struct Fields {
6+ /// [crate::Struct::clone]
7+ pub field : u8 ,
8+ }
9+ }
10+
11+ pub mod dep_mod2 {
12+ pub enum Fields {
13+ V {
14+ /// [crate::Struct::clone]
15+ field : u8 ,
16+ } ,
17+ }
18+ }
You can’t perform that action at this time.
0 commit comments