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

rustdoc: --show-coverage shouldn't count tuple struct fields #83255

Closed
taylordotfish opened this issue Mar 18, 2021 · 4 comments
Closed

rustdoc: --show-coverage shouldn't count tuple struct fields #83255

taylordotfish opened this issue Mar 18, 2021 · 4 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

@taylordotfish
Copy link

rustdoc's --show-coverage flag counts public fields of tuple structs, but this doesn't really make sense, since doc attributes on such fields never appear in the generated documentation.

For example, given the following in src/lib.rs:

//! test

/// test
pub struct Test(pub u8);

cargo rustdoc -- -Z unstable-options --show-coverage reports:

+-------------------------------------+------------+------------+------------+------------+
| File                                | Documented | Percentage |   Examples | Percentage |
+-------------------------------------+------------+------------+------------+------------+
| src/lib.rs                          |          2 |      66.7% |          0 |       0.0% |
+-------------------------------------+------------+------------+------------+------------+
| Total                               |          2 |      66.7% |          0 |       0.0% |
+-------------------------------------+------------+------------+------------+------------+

If src/lib.rs is changed to:

//! test

/// test
pub struct Test(
    /// test
    pub u8,
);

then the coverage is reported as 100%, but, as expected, the documentation for the pub u8 field isn't included in the documentation generated by cargo doc.

Meta

rustc 1.52.0-nightly (f5d8117c3 2021-03-16)
binary: rustc
commit-hash: f5d8117c338a788bd24abec733fd143dfceb25a0
commit-date: 2021-03-16
host: powerpc64le-unknown-linux-gnu
release: 1.52.0-nightly
LLVM version: 12.0.0
@taylordotfish taylordotfish added the C-bug Category: This is a bug. label Mar 18, 2021
@jonas-schievink jonas-schievink added A-doc-coverage Area: Calculating how much of a crate has documentation T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. labels Mar 18, 2021
@camelid
Copy link
Member

camelid commented Mar 21, 2021

Tuple struct field docs will be rendered soon, assuming that #80320 merges.

GuillaumeGomez added a commit to GuillaumeGomez/rust that referenced this issue Jul 27, 2021
…oc, r=jyn514

Add support for tuple struct field documentation

Fixes  rust-lang#42615.
This is rust-lang#80320 updated to new codebase and with added tests.
Part of rust-lang#83255.

cc `@camelid` (since you were involved on the original PR).
r? `@jyn514`
JohnTitor added a commit to JohnTitor/rust that referenced this issue Jul 28, 2021
…oc, r=jyn514

Add support for tuple struct field documentation

Fixes  rust-lang#42615.
This is rust-lang#80320 updated to new codebase and with added tests.
Part of rust-lang#83255.

cc ``@camelid`` (since you were involved on the original PR).
r? ``@jyn514``
JohnTitor added a commit to JohnTitor/rust that referenced this issue Jul 28, 2021
…oc, r=jyn514

Add support for tuple struct field documentation

Fixes  rust-lang#42615.
This is rust-lang#80320 updated to new codebase and with added tests.
Part of rust-lang#83255.

cc ```@camelid``` (since you were involved on the original PR).
r? ```@jyn514```
@GuillaumeGomez
Copy link
Member

I guess we can now consider this issue to be fixed since #87451 was merged?

@camelid
Copy link
Member

camelid commented Aug 3, 2021

@GuillaumeGomez that sounds right to me. Do you want to close it?

@GuillaumeGomez
Copy link
Member

Let's close it then. :)

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

5 participants