rust-lang / rust-lang/rust

Certain items are ignored when computing documentation coverage

Open
#145,087 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

A-doc-coverage C-bug E-needs-mcve T-rustdoc
Dominant language
Rust
Stars
119k
Forks
16.1k
PR merge metrics
PR metrics pending

Description

Code

I discussed this on https://github.com/rust-lang/docs.rs/issues/2884 . @GuillaumeGomez suggested it might be bug, so I am reporting it here.

It seems that certain items are ignored when computing documentation coverage.

The file src/c_api/pdfium.rs contains more than 400 functions with documentation, but these functions are not counted.

The reason might be either that the impl is in a different file than the struct definition (done here to keep stuff manageable) or because they don't follow the rust naming conventions as they map directly to C functions.

In either case I would expect them to be counted. Now we are ignoring a major part of the crate.

Reproduction Steps

git clone https://github.com/newinnovations/PDFium-rs.git
cd PDFium-rs/
git checkout 92baa03
cargo rustdoc -- --show-coverage -Z unstable-options

Expected Outcome

That src/c_api/pdfium.rs was counted and part of the report.

Actual Output

 Documenting pdfium v0.9.3 (/tmp/PDFium-rs)
+-------------------------------------+------------+------------+------------+------------+
| File                                | Documented | Percentage |   Examples | Percentage |
+-------------------------------------+------------+------------+------------+------------+
| src/action.rs                       |          1 |     100.0% |          0 |       0.0% |
| src/annotation.rs                   |          1 |     100.0% |          0 |       0.0% |
| src/attachment.rs                   |          1 |     100.0% |          0 |       0.0% |
| src/availability.rs                 |          1 |     100.0% |          0 |       0.0% |
| src/bitmap/mod.rs                   |          8 |     100.0% |          0 |       0.0% |
| src/bookmark.rs                     |          1 |     100.0% |          0 |       0.0% |
| src/c_api/guard.rs                  |          4 |     100.0% |          0 |       0.0% |
| src/c_api/pdfium_bindings.rs        |          1 |     100.0% |          0 |       0.0% |
| src/c_api/pdfium_constants.rs       |        199 |     100.0% |          0 |       0.0% |
| src/c_api/pdfium_handle.rs          |          1 |     100.0% |          0 |       0.0% |
| src/c_api/pdfium_types.rs           |        312 |     100.0% |          0 |       0.0% |
| src/clip_path.rs                    |          1 |     100.0% |          0 |       0.0% |
| src/color.rs                        |          1 |     100.0% |          0 |       0.0% |
| src/destination.rs                  |          1 |     100.0% |          0 |       0.0% |
| src/document/mod.rs                 |          1 |     100.0% |          0 |       0.0% |
| src/document/reader.rs              |          1 |     100.0% |          0 |       0.0% |
| src/error.rs                        |         18 |     100.0% |          0 |       0.0% |
| src/font.rs                         |          1 |     100.0% |          0 |       0.0% |
| src/form.rs                         |          1 |     100.0% |          0 |       0.0% |
| src/glyph_path.rs                   |          1 |     100.0% |          0 |       0.0% |
| src/javascript_action.rs            |          1 |     100.0% |          0 |       0.0% |
| src/lib.rs                          |          1 |     100.0% |          1 |     100.0% |
| src/link.rs                         |          1 |     100.0% |          0 |       0.0% |
| src/matrix.rs                       |          1 |     100.0% |          0 |       0.0% |
| src/page/boundaries.rs              |          1 |     100.0% |          0 |       0.0% |
| src/page/link.rs                    |          1 |     100.0% |          0 |       0.0% |
| src/page/mod.rs                     |          1 |     100.0% |          0 |       0.0% |
| src/page/object/mark.rs             |          1 |     100.0% |          0 |       0.0% |
| src/page/object/mod.rs              |          1 |     100.0% |          0 |       0.0% |
| src/page/range.rs                   |          1 |     100.0% |          0 |       0.0% |
| src/page/render.rs                  |          2 |     100.0% |          1 |     100.0% |
| src/page/text/mod.rs                |          1 |     100.0% |          0 |       0.0% |
| src/page/text/search.rs             |          2 |     100.0% |          1 |     100.0% |
| src/path_segment.rs                 |          1 |     100.0% |          0 |       0.0% |
| src/rect.rs                         |          5 |     100.0% |          0 |       0.0% |
| src/signature.rs                    |          1 |     100.0% |          0 |       0.0% |
| src/struct_element.rs               |          1 |     100.0% |          0 |       0.0% |
| src/struct_element_attr.rs          |          1 |     100.0% |          0 |       0.0% |
| src/struct_element_attr_value.rs    |          1 |     100.0% |          0 |       0.0% |
| src/struct_tree.rs                  |          1 |     100.0% |          0 |       0.0% |
| src/xobject.rs                      |          1 |     100.0% |          0 |       0.0% |
+-------------------------------------+------------+------------+------------+------------+
| Total                               |        583 |     100.0% |          3 |     100.0% |
+-------------------------------------+------------+------------+------------+------------+
    Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.19s

Version

rustdoc 1.91.0-nightly (7d82b83ed 2025-08-06)

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the report with cargo rustdoc -- --show-coverage -Z unstable-options at the specified PDFium-rs checkout and compare the listed files with src/c_api/pdfium.rs. Trace how rustdoc discovers and counts documented functions, then ensure those functions appear in the coverage report without excluding the separate impl or C-style names.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
documentation
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.