`rustdoc --show-coverage` misses associated items on public items re-exported from private modules
Open
Nobody has claimed this yet.
A-doc-coverage
C-bug
T-rustdoc
- Dominant language
- Rust
- Stars
- 119k
- Forks
- 16.1k
- PR merge metrics
- PR metrics pending
Description
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
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the issue from the src/lib.rs, src/foo.rs, and src/bar.rs examples with cargo rustdoc -- --show-coverage -Zunstable-options. Compare coverage for the re-exported Bar and its undocumented associated method, including the non-inline module case. Done means the report counts the associated item and reflects its missing documentation.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- documentation, tooling
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100