Skip to content

rustdoc --show-coverage misses associated items on public items re-exported from private modules #129007

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

Open
Nemo157 opened this issue Aug 12, 2024 · 0 comments
Labels
A-doc-coverage Area: Calculating how much of a crate has documentation C-bug Category: This is a bug. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.

Comments

@Nemo157
Copy link
Member

Nemo157 commented Aug 12, 2024

I tried this code:

// src/lib.rs
//! ```
//! ```

pub mod foo;
pub mod bar;
// src/foo.rs
//! ```
//! ```

/// ```
/// ```
pub struct Foo;

impl Foo {
    /// ```
    /// ```
    pub fn foo() {}
}
// src/bar.rs
//! ```
//! ```

mod inner {
    /// ```
    /// ```
    pub struct Bar;

    impl Bar {
        pub fn bar() {}
    }
}

pub use inner::Bar;
> cargo rustdoc -- --show-coverage -Zunstable-options

I expected to see this happen:

+-------------------------------------+------------+------------+------------+------------+
| File                                | Documented | Percentage |   Examples | Percentage |
+-------------------------------------+------------+------------+------------+------------+
| src/bar.rs                          |          2 |      66.7% |          2 |      66.7% |
| src/foo.rs                          |          3 |     100.0% |          3 |     100.0% |
| src/lib.rs                          |          1 |     100.0% |          1 |     100.0% |
+-------------------------------------+------------+------------+------------+------------+
| Total                               |          6 |     100.0% |          6 |     100.0% |
+-------------------------------------+------------+------------+------------+------------+

Instead, this happened:

+-------------------------------------+------------+------------+------------+------------+
| File                                | Documented | Percentage |   Examples | Percentage |
+-------------------------------------+------------+------------+------------+------------+
| src/bar.rs                          |          2 |     100.0% |          2 |     100.0% |
| src/foo.rs                          |          3 |     100.0% |          3 |     100.0% |
| src/lib.rs                          |          1 |     100.0% |          1 |     100.0% |
+-------------------------------------+------------+------------+------------+------------+
| Total                               |          6 |     100.0% |          6 |     100.0% |
+-------------------------------------+------------+------------+------------+------------+

src/bar.rs is ignoring the undocumented public method.

The same also happens with non-inline modules.

Meta

rustdoc 1.82.0-nightly (64ebd39da 2024-08-03)
binary: rustdoc
commit-hash: 64ebd39da5ec28caa3bd7cbb3f22f5949432fe2b
commit-date: 2024-08-03
host: x86_64-unknown-linux-gnu
release: 1.82.0-nightly
LLVM version: 19.1.0
@Nemo157 Nemo157 added T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. C-bug Category: This is a bug. A-doc-coverage Area: Calculating how much of a crate has documentation labels Aug 12, 2024
@rustbot rustbot added the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Aug 12, 2024
@jieyouxu jieyouxu removed the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Aug 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-doc-coverage Area: Calculating how much of a crate has documentation 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
Development

No branches or pull requests

3 participants