Skip to content

Make rustdoc --passes and rustdoc --no-defaults have no effect #91714

Closed

Description

Currently, rustdoc --passes does one of two things:

  1. --passes list shows a list of available passes:
Available passes for running rustdoc:
check_doc_test_visibility - run various visibility-related lints on doctests
        strip-hidden - strips all `#[doc(hidden)]` items from the output
   unindent-comments - removes excess indentation on comments in order for markdown to like it
       strip-private - strips all private items from a crate which cannot be seen externally, implies strip-priv-imports
  strip-priv-imports - strips all private import statements (`use`, `extern crate`) from a crate
   propagate-doc-cfg - propagates `#[doc(cfg(...))]` to child items
collect-intra-doc-links - resolves intra-doc links
check-code-block-syntax - validates syntax inside Rust code blocks
 collect-trait-impls - retrieves trait impls for items in the crate
calculate-doc-coverage - counts the number of items with and without documentation
check-invalid-html-tags - detects invalid HTML tags in doc comments
     check-bare-urls - detects URLs that are not hyperlinks

Default passes for rustdoc:
 collect-trait-impls
   unindent-comments
check_doc_test_visibility
        strip-hidden  (when not --document-hidden-items)
       strip-private  (when not --document-private-items)
  strip-priv-imports  (when --document-private-items)
collect-intra-doc-links
check-code-block-syntax
check-invalid-html-tags
   propagate-doc-cfg
     check-bare-urls

Passes run with `--show-coverage`:
        strip-hidden  (when not --document-hidden-items)
       strip-private  (when not --document-private-items)
calculate-doc-coverage
  1. rustdoc --passes collect-trait-impls will add that specific pass to the list of passes rustdoc executes (I think this is intended to be used with --no-defaults, which is also deprecated).

Both of these are stable, so unfortunately we can't remove them; 2. is deprecated and 1. should be soon (after #91713 is fixed). However, this is not a very useful sort of stability, because the names and number of passes is not stable, and rustdoc is very likely to be buggy if you don't run all passes (there's no sort of test for this).

I propose not just deprecating --passes and --no-defaults but making them a no-op altogether, which means less complexity both for users and in the rustdoc codebase. I also suggest removing the CLI help at the same time (and just say "this flag is a no-op").

Note that the only other deprecated flag, --input-format, is also currently a no-op when used with --input-format rust, and a hard error otherwise. We could go further and make everything but --passes=list be a hard error, but that seems like more of a breaking change than necessary for the goal of reducing complexity.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

Labels

E-easyCall for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.E-mentorCall for participation: This issue has a mentor. Use #t-compiler/help on Zulip for discussion.T-rustdocRelevant to the rustdoc team, which will review and decide on the PR/issue.disposition-mergeThis issue / PR is in PFCP or FCP with a disposition to merge it.finished-final-comment-periodThe final comment period is finished for this PR / Issue.needs-fcpThis change is insta-stable, so needs a completed FCP to proceed.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions