Skip to content
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

Documentation on re-exports is ignored if the item is defined in the same crate #84619

Closed
jyn514 opened this issue Apr 27, 2021 · 6 comments · Fixed by #103886
Closed

Documentation on re-exports is ignored if the item is defined in the same crate #84619

jyn514 opened this issue Apr 27, 2021 · 6 comments · Fixed by #103886
Assignees
Labels
A-cross-crate-reexports Area: Documentation that has been re-exported from a different crate C-bug Category: This is a bug. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.

Comments

@jyn514
Copy link
Member

jyn514 commented Apr 27, 2021

I tried this code:

mod inner_mod {
    /// docs from inner module
    pub fn g() {}
}

/// docs from outer module
pub use inner_mod::g;

I expected to see this happen: The documentation is added, like it is for cross-crate re-exports:
image

/// Some docs from outer crate
pub use inner::f;

Instead, this happened: The documentation is ignored:

image

Meta

rustdoc --version: rustdoc 1.53.0-nightly (392ba2b 2021-04-17)

Originally posted by @jsgf in #84597 (comment)

@jyn514 jyn514 added C-bug Category: This is a bug. A-cross-crate-reexports Area: Documentation that has been re-exported from a different crate T-rustdoc T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. and removed T-rustdoc labels Apr 27, 2021
@Lonami
Copy link
Contributor

Lonami commented May 22, 2021

Concatenating both doc-comments seems slightly strange to me, at least for the same crate. My expectation is that the re-export would have its own and, if you navigate to the re-exported name, you see the original documentation.

@jyn514
Copy link
Member Author

jyn514 commented May 22, 2021

@Lonami concatenating them is what rustdoc does for cross crate links, it should do the same thing for intra crate links. We shouldn't change it now.

@jyn514
Copy link
Member Author

jyn514 commented Jun 6, 2021

Well, here's why:

if did.is_local() {
return None;
}

but removing that block breaks rustdoc quite a lot:

failures:
    [rustdoc] rustdoc/foreigntype-reexport.rs
    [rustdoc] rustdoc/inline_local/please_inline.rs
    [rustdoc] rustdoc/intra-doc/field.rs
    [rustdoc] rustdoc/proc-macro.rs
    [rustdoc] rustdoc/reexport-stability-tags-deprecated-and-portability.rs
    [rustdoc] rustdoc/reexport-stability-tags-unstable-and-portability.rs

@Lonami
Copy link
Contributor

Lonami commented Jun 8, 2021

I'm not familiar with rustdoc tests, but looks like we should just update the expected results for the tests (assuming we do want to do this change, of course). As in, I don't think things are "breaking" as signaled by the failing tests with this change, but rather it just needs updating.

@jyn514
Copy link
Member Author

jyn514 commented Jun 8, 2021

@Lonami no, there are larger changes, it's not just documentation being added. I don't have the exact output on hand, it was a lot.

@lambinoo
Copy link
Contributor

I think I'll try to tackle this one! Maybe this will also fix #89020
@rustbot claim

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-cross-crate-reexports Area: Documentation that has been re-exported from a different crate C-bug Category: This is a bug. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.
Projects
None yet
3 participants