Skip to content

[rustdoc] Correctly handle output options with --show-coverage - #159411

Merged
rust-bors[bot] merged 7 commits into
rust-lang:mainfrom
GuillaumeGomez:show-coverage
Jul 30, 2026
Merged

[rustdoc] Correctly handle output options with --show-coverage#159411
rust-bors[bot] merged 7 commits into
rust-lang:mainfrom
GuillaumeGomez:show-coverage

Conversation

@GuillaumeGomez

@GuillaumeGomez GuillaumeGomez commented Jul 16, 2026

Copy link
Copy Markdown
Member

View all comments

Fixes #158929.

The -o option was ignored with --show-coverage. This PR takes it into account and makes it closer to how these options are handled in the rest of rustdoc.

Considering calculate_doc_coverage was never really a pass and that I needed RenderOptions (for the -o option), I moved it out of passes.

r? @camelid

@rustbot rustbot added A-run-make Area: port run-make Makefiles to rmake.rs S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. labels Jul 16, 2026
@rustbot

rustbot commented Jul 16, 2026

Copy link
Copy Markdown
Collaborator

camelid is currently at their maximum review capacity.
They may take a while to respond.

@GuillaumeGomez

Copy link
Copy Markdown
Member Author

Ah, maybe @Urgau then?

r? @Urgau

@rustbot rustbot assigned Urgau and unassigned camelid Jul 16, 2026
@rust-log-analyzer

This comment has been minimized.

@Urgau

Urgau commented Jul 16, 2026

Copy link
Copy Markdown
Member

I haven't looked at the implementation, but it seems a bit weird to me to have an flag called --show-coverage that doesn't show anything when used with -o. Are we worried about confusing users?

#158929 suggests updating the documentation instead.
cc @aDotInTheVoid (in case you have an opinion)

@GuillaumeGomez

Copy link
Copy Markdown
Member Author

I haven't looked at the implementation, but it seems a bit weird to me to have an flag called --show-coverage that doesn't show anything when used with -o. Are we worried about confusing users?

#158929 suggests updating the documentation instead. cc @aDotInTheVoid (in case you have an opinion)

If you want to generate the output in a file, that seems kinda logical to not have output on stdout.

@rust-log-analyzer

This comment has been minimized.

@Urgau

Urgau commented Jul 17, 2026

Copy link
Copy Markdown
Member

If you want to generate the output in a file, that seems kinda logical to not have output on stdout.

100% agree, but the CLI option is called --show-..., that implies (at least to me) -o - (i.e. the current behavior). Maybe we should have --coverage?

Is there a way to know if some users are currently relying on the current behavior? (since this is a breaking change)

@Urgau Urgau added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Jul 17, 2026
@GuillaumeGomez

Copy link
Copy Markdown
Member Author

docs.rs. We could rename the option, I don't mind. But something like --doc-coverage seems better than just coverage, no?

@Urgau

Urgau commented Jul 20, 2026

Copy link
Copy Markdown
Member

Yeah, --doc-coverage seems fine. I'm mostly worried about the breaking change to --show-coverage, so if -o is respected only for this new option, that seems fine to me.

@GuillaumeGomez

Copy link
Copy Markdown
Member Author

It's a nightly only option, so breaking changes are fine. Although in this case, as long as you don't use -o, there is no change.

@Urgau

Urgau commented Jul 21, 2026

Copy link
Copy Markdown
Member

Oh! I thought --show-coverage was stable, never-mind about the breaking change then.

Though I still think renaming it to --doc-coverage would be better.

@GuillaumeGomez

Copy link
Copy Markdown
Member Author

A follow-up and an issue about doing it would be good since we'll need an FCP. ;)

@Urgau

Urgau commented Jul 21, 2026

Copy link
Copy Markdown
Member

Created #159691 for the rename.

@Urgau

Urgau commented Jul 21, 2026

Copy link
Copy Markdown
Member

@bors r+

@rust-bors

rust-bors Bot commented Jul 21, 2026

Copy link
Copy Markdown
Contributor

📌 Commit 1010137 has been approved by Urgau

It is now in the queue for this repository.

@rust-bors rust-bors Bot added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Jul 21, 2026
GuillaumeGomez added a commit to GuillaumeGomez/rust that referenced this pull request Jul 21, 2026
[rustdoc] Correctly handle output options with --show-coverage

Fixes rust-lang#158929.

The `-o` option was ignored with `--show-coverage`. This PR takes it into account and makes it closer to how these options are handled in the rest of rustdoc.

Considering `calculate_doc_coverage` was never really a pass and that I needed `RenderOptions` (for the `-o` option), I moved it out of passes.

r? @camelid
@rust-bors rust-bors Bot added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Jul 25, 2026
@rust-bors

rust-bors Bot commented Jul 25, 2026

Copy link
Copy Markdown
Contributor

This pull request was unapproved.

This PR was contained in a rollup (#159905), which was unapproved.

View changes since this unapproval

@camelid

camelid commented Jul 25, 2026

Copy link
Copy Markdown
Member
 failures:
  
  ---- [run-make] tests\run-make\rustdoc-show-coverage stdout ----
  
  error: rmake recipe failed to complete
  status: exit code: 101
  command: "C:\\a\\rust\\rust\\build\\aarch64-pc-windows-msvc\\test\\run-make\\rustdoc-show-coverage\\rmake.exe"
  stdout: none
  --- stderr -------------------------------
  "C:\\a\\rust\\rust\\build\\aarch64-pc-windows-msvc\\stage2\\bin\\rustdoc.exe" "foo.rs" "-Zunstable-options" "--show-coverage" "--target=aarch64-pc-windows-msvc"
  output status: `exit code: 0`
  === STDOUT ===
  +-------------------------------------+------------+------------+------------+------------+
  | File                                | Documented | Percentage |   Examples | Percentage |
  +-------------------------------------+------------+------------+------------+------------+
  | foo.rs                              |          0 |       0.0% |          0 |       0.0% |
  +-------------------------------------+------------+------------+------------+------------+
  | Total                               |          0 |       0.0% |          0 |       0.0% |
  +-------------------------------------+------------+------------+------------+------------+
  
  
  
  === STDERR ===
  
  
  
  "C:\\a\\rust\\rust\\build\\aarch64-pc-windows-msvc\\stage2\\bin\\rustdoc.exe" "foo.rs" "-Zunstable-options" "--show-coverage" "-o" "-" "--target=aarch64-pc-windows-msvc"
  output status: `exit code: 0`
  === STDOUT ===
  +-------------------------------------+------------+------------+------------+------------+
  | File                                | Documented | Percentage |   Examples | Percentage |
  +-------------------------------------+------------+------------+------------+------------+
  | foo.rs                              |          0 |       0.0% |          0 |       0.0% |
  +-------------------------------------+------------+------------+------------+------------+
  | Total                               |          0 |       0.0% |          0 |       0.0% |
  +-------------------------------------+------------+------------+------------+------------+
  
  
  
  === STDERR ===
  
  
  
  "C:\\a\\rust\\rust\\build\\aarch64-pc-windows-msvc\\stage2\\bin\\rustdoc.exe" "foo.rs" "-Zunstable-options" "--show-coverage" "--output-format=json" "--target=aarch64-pc-windows-msvc"
  output status: `exit code: 0`
  === STDOUT ===
  {"foo.rs":{"total":3,"with_docs":0,"total_examples":2,"with_examples":0}}
  
  
  
  === STDERR ===
  
  
  
  "C:\\a\\rust\\rust\\build\\aarch64-pc-windows-msvc\\stage2\\bin\\rustdoc.exe" "foo.rs" "-Zunstable-options" "--show-coverage" "--output-format=json" "-o" "-" "--target=aarch64-pc-windows-msvc"
  output status: `exit code: 0`
  === STDOUT ===
  {"foo.rs":{"total":3,"with_docs":0,"total_examples":2,"with_examples":0}}
  
  
  
  === STDERR ===
  
  
  
  "C:\\a\\rust\\rust\\build\\aarch64-pc-windows-msvc\\stage2\\bin\\rustdoc.exe" "foo.rs" "-Zunstable-options" "--show-coverage" "-o" "doc" "--target=aarch64-pc-windows-msvc"
  output status: `exit code: 0`
  === STDOUT ===
  Generated output into "doc\\foo.txt"
  
  
  
  === STDERR ===
  
  
  
  assert_contains_regex:
  === HAYSTACK ===
  Generated output into "doc\\foo.txt"
  
  === NEEDLE ===
  Generated output into "doc[/\\]foo.txt"
  
  
  thread 'main' (9516) panicked at C:\a\rust\rust\tests\run-make\rustdoc-show-coverage\rmake.rs:40:5:
  regex was not found in haystack
  note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
  ------------------------------------------
  
  ---- [run-make] tests\run-make\rustdoc-show-coverage stdout end ----
  
  failures:
      [run-make] tests\run-make\rustdoc-show-coverage

@GuillaumeGomez

Copy link
Copy Markdown
Member Author

@bors try jobs=aarch64-msvc-1

@rust-bors

This comment has been minimized.

rust-bors Bot pushed a commit that referenced this pull request Jul 25, 2026
[rustdoc] Correctly handle output options with --show-coverage


try-job: aarch64-msvc-1
@rust-bors

rust-bors Bot commented Jul 25, 2026

Copy link
Copy Markdown
Contributor

💔 Test for 49bbeb7 failed: CI. Failed job:

@rust-log-analyzer

This comment has been minimized.

@GuillaumeGomez

Copy link
Copy Markdown
Member Author

And fixed CI...

@GuillaumeGomez

Copy link
Copy Markdown
Member Author

@rustbot ready

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Jul 27, 2026
@Urgau

Urgau commented Jul 29, 2026

Copy link
Copy Markdown
Member

@bors r=Urgau,aDotInTheVoid rollup

@rust-bors

rust-bors Bot commented Jul 29, 2026

Copy link
Copy Markdown
Contributor

📌 Commit 41704bd has been approved by Urgau,aDotInTheVoid

It is now in the queue for this repository.

@rust-bors rust-bors Bot added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Jul 29, 2026
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Jul 29, 2026
…gau,aDotInTheVoid

[rustdoc] Correctly handle output options with --show-coverage

Fixes rust-lang#158929.

The `-o` option was ignored with `--show-coverage`. This PR takes it into account and makes it closer to how these options are handled in the rest of rustdoc.

Considering `calculate_doc_coverage` was never really a pass and that I needed `RenderOptions` (for the `-o` option), I moved it out of passes.

r? @camelid
rust-bors Bot pushed a commit that referenced this pull request Jul 29, 2026
…uwer

Rollup of 18 pull requests

Successful merges:

 - #159898 (Add intrinsic-test alias and set  sample rate)
 - #158247 (hermit/fs: Return `unsupported()` instead of `from_raw_os_error(22)`)
 - #158649 (Hermit: fix `readdir()` )
 - #158693 (Add type-check to offload intrinisc calls)
 - #159049 (Avoid ICE in From/TryFrom cast suggestion when encountering HRTBs)
 - #159411 ([rustdoc] Correctly handle output options with --show-coverage)
 - #160053 (test: add test suite for the 85681 issue)
 - #160087 (Add regression test for nested associated-type projection ICE)
 - #160090 (rustc_resolve: Further reduce mutability in resolver)
 - #160099 (Resolver: split module resolutions into local and external resolutions)
 - #160106 (Add suggestions for `must_implement_one_of`)
 - #160117 (Remove unnecessary format usage)
 - #160134 (Work around Wine bug 60084 by calling WSAStartup at most once)
 - #160139 (iter: specialize Take::count using advance_by)
 - #160142 (bootstrap: remove use-lld config alias)
 - #160148 (Rename `errors.rs` file to `diagnostics.rs` (15/N))
 - #160151 (Mark a doctest as requiring unwinding)
 - #160166 (Use correct feature gates for `f16`/`f128` `From` impls)
rust-bors Bot pushed a commit that referenced this pull request Jul 30, 2026
Rollup of 20 pull requests

Successful merges:

 - #157669 (cfi: add diag mode support)
 - #158247 (hermit/fs: Return `unsupported()` instead of `from_raw_os_error(22)`)
 - #158649 (Hermit: fix `readdir()` )
 - #158693 (Add type-check to offload intrinisc calls)
 - #159049 (Avoid ICE in From/TryFrom cast suggestion when encountering HRTBs)
 - #159411 ([rustdoc] Correctly handle output options with --show-coverage)
 - #160053 (test: add test suite for the 85681 issue)
 - #160087 (Add regression test for nested associated-type projection ICE)
 - #160090 (rustc_resolve: Further reduce mutability in resolver)
 - #160099 (Resolver: split module resolutions into local and external resolutions)
 - #160101 (Add missing `needs-unwind` annotation to `add-spawn-hook-reentrancy-159923` test)
 - #160106 (Add suggestions for `must_implement_one_of`)
 - #160117 (Remove unnecessary format usage)
 - #160134 (Work around Wine bug 60084 by calling WSAStartup at most once)
 - #160139 (iter: specialize Take::count using advance_by)
 - #160142 (bootstrap: remove use-lld config alias)
 - #160148 (Rename `errors.rs` file to `diagnostics.rs` (15/N))
 - #160151 (Mark a doctest as requiring unwinding)
 - #160166 (Use correct feature gates for `f16`/`f128` `From` impls)
 - #160178 (Remove unused `va_start` intrinsic)
rust-bors Bot pushed a commit that referenced this pull request Jul 30, 2026
Rollup of 20 pull requests

Successful merges:

 - #157669 (cfi: add diag mode support)
 - #158247 (hermit/fs: Return `unsupported()` instead of `from_raw_os_error(22)`)
 - #158649 (Hermit: fix `readdir()` )
 - #158693 (Add type-check to offload intrinisc calls)
 - #159049 (Avoid ICE in From/TryFrom cast suggestion when encountering HRTBs)
 - #159411 ([rustdoc] Correctly handle output options with --show-coverage)
 - #160053 (test: add test suite for the 85681 issue)
 - #160087 (Add regression test for nested associated-type projection ICE)
 - #160090 (rustc_resolve: Further reduce mutability in resolver)
 - #160099 (Resolver: split module resolutions into local and external resolutions)
 - #160101 (Add missing `needs-unwind` annotation to `add-spawn-hook-reentrancy-159923` test)
 - #160106 (Add suggestions for `must_implement_one_of`)
 - #160117 (Remove unnecessary format usage)
 - #160134 (Work around Wine bug 60084 by calling WSAStartup at most once)
 - #160139 (iter: specialize Take::count using advance_by)
 - #160142 (bootstrap: remove use-lld config alias)
 - #160148 (Rename `errors.rs` file to `diagnostics.rs` (15/N))
 - #160151 (Mark a doctest as requiring unwinding)
 - #160166 (Use correct feature gates for `f16`/`f128` `From` impls)
 - #160178 (Remove unused `va_start` intrinsic)
@rust-bors
rust-bors Bot merged commit f0a77d9 into rust-lang:main Jul 30, 2026
13 checks passed
@rustbot rustbot added this to the 1.99.0 milestone Jul 30, 2026
rust-timer added a commit that referenced this pull request Jul 30, 2026
Rollup merge of #159411 - GuillaumeGomez:show-coverage, r=Urgau,aDotInTheVoid

[rustdoc] Correctly handle output options with --show-coverage

Fixes #158929.

The `-o` option was ignored with `--show-coverage`. This PR takes it into account and makes it closer to how these options are handled in the rest of rustdoc.

Considering `calculate_doc_coverage` was never really a pass and that I needed `RenderOptions` (for the `-o` option), I moved it out of passes.

r? @camelid
@GuillaumeGomez
GuillaumeGomez deleted the show-coverage branch July 30, 2026 10:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-run-make Area: port run-make Makefiles to rmake.rs S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

rustdoc: --show-coverage --output-format=json doesn't respect -o, but the docs suggest it will.

8 participants