-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Closed
Labels
A-intra-doc-linksArea: Intra-doc links, the ability to link to items in docs by nameArea: Intra-doc links, the ability to link to items in docs by nameA-local-reexportsArea: Documentation that has been locally re-exported (i.e., non-cross-crate)Area: Documentation that has been locally re-exported (i.e., non-cross-crate)A-macrosArea: All kinds of macros (custom derive, macro_rules!, proc macros, ..)Area: All kinds of macros (custom derive, macro_rules!, proc macros, ..)C-bugCategory: This is a bug.Category: This is a bug.T-rustdocRelevant to the rustdoc team, which will review and decide on the PR/issue.Relevant to the rustdoc team, which will review and decide on the PR/issue.
Description
I know this is a niche situation, but encountered this in some macro-heavy code I actually would like to write.
Code
#[doc(hidden)]
pub struct MyStruct;
macro_rules! my_macro {
() => {
pub fn my_function() {}
/// Incorrect: [`my_function()`].
#[doc(inline)]
pub use $crate::MyStruct;
/// Correct: [`my_function()`].
pub struct AnotherStruct;
};
}
pub mod one {
my_macro!();
}
pub mod two {
my_macro!();
}
Reproduction Steps
Run rustdoc, look at the documentation of module two
.
Expected Outcome
Both links in module two
should link to two::my_function
.
Actual Output
The docstring of the re-exported struct in module two
links to one::my_function
.
Version
rustdoc 1.88.0 (6b00bc388 2025-06-23)
Metadata
Metadata
Assignees
Labels
A-intra-doc-linksArea: Intra-doc links, the ability to link to items in docs by nameArea: Intra-doc links, the ability to link to items in docs by nameA-local-reexportsArea: Documentation that has been locally re-exported (i.e., non-cross-crate)Area: Documentation that has been locally re-exported (i.e., non-cross-crate)A-macrosArea: All kinds of macros (custom derive, macro_rules!, proc macros, ..)Area: All kinds of macros (custom derive, macro_rules!, proc macros, ..)C-bugCategory: This is a bug.Category: This is a bug.T-rustdocRelevant to the rustdoc team, which will review and decide on the PR/issue.Relevant to the rustdoc team, which will review and decide on the PR/issue.