forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Auto merge of rust-lang#96447 - petrochenkov:docregr, r=GuillaumeGomez
rustdoc: Resolve doc links on fields during early resolution Another subset of rust-lang#94857 which fixes rust-lang#96429. This case regressed in rust-lang#96135 when `may_have_doc_links`-based filtering was introduced. Before that filtering structs could collect traits in scope for their fields, but after the filtering structs won't collect anything if they don't have doc comments on them, so we have to visit fields too.
- Loading branch information
Showing
3 changed files
with
57 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
// Traits in scope are collected for doc links in field attributes. | ||
|
||
// check-pass | ||
// aux-build: assoc-field-dep.rs | ||
|
||
extern crate assoc_field_dep; | ||
pub use assoc_field_dep::*; | ||
|
||
#[derive(Clone)] | ||
pub struct Struct; | ||
|
||
pub mod mod1 { | ||
pub struct Fields { | ||
/// [crate::Struct::clone] | ||
pub field: u8, | ||
} | ||
} | ||
|
||
pub mod mod2 { | ||
pub enum Fields { | ||
V { | ||
/// [crate::Struct::clone] | ||
field: u8, | ||
}, | ||
} | ||
} |
18 changes: 18 additions & 0 deletions
18
src/test/rustdoc-ui/intra-doc/auxiliary/assoc-field-dep.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
#[derive(Clone)] | ||
pub struct Struct; | ||
|
||
pub mod dep_mod1 { | ||
pub struct Fields { | ||
/// [crate::Struct::clone] | ||
pub field: u8, | ||
} | ||
} | ||
|
||
pub mod dep_mod2 { | ||
pub enum Fields { | ||
V { | ||
/// [crate::Struct::clone] | ||
field: u8, | ||
}, | ||
} | ||
} |