New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rustdoc intra links: Module-level doc uses parent module's namespace instead of own #55364

Open
crumblingstatue opened this Issue Oct 25, 2018 · 2 comments

Comments

Projects
None yet
5 participants
@crumblingstatue
Contributor

crumblingstatue commented Oct 25, 2018

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

@Nemo157

This comment has been minimized.

Contributor

Nemo157 commented Oct 26, 2018

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.

@Manishearth

This comment has been minimized.

Member

Manishearth commented Nov 27, 2018

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.

@nrc nrc referenced this issue Nov 27, 2018

Open

Tracking issue for RFC 1946 - intra-rustdoc links #43466

12 of 17 tasks complete
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment