rustdoc intra links: Module-level doc uses parent module's namespace instead of own
crumblingstatue opened this issue · 2 comments
pub mod sub {
//! See either [foo] or [bar].
/// See [bar]
pub fn foo() {}
/// See [foo]
pub fn bar() {}
}2 | //! See either [foo] or [bar].
| ^^^ cannot be resolved, ignoring
I don't know if this is an accidental regression, or an intentional change, but this used to resolve.
I argue that module-level docs should have the same namespace as the module they are referring to, since referring to the items of the documented module is much more common than referring to items in the parent module.
Ref #43466
I definitely agree with the motivation.
One issue is what about outer-doc comments on a module?
/// See either [foo] or [bar].
pub mod sub {
/// See [bar]
pub fn foo() {}
/// See [foo]
pub fn bar() {}
}I'm not sure if they're distinguishable to rustdoc, and also not sure whether they should have the same behaviour or resolve from the module in which they're actually written.
They are distinguishable, I recall I knowingly skipped this when implementing this feature because it was tricky to get right and I wasn't sure which way we wanted it to work.