Clarify that cargo doc --no-deps is cumulative and won’t delete prev (#15800)

### What does this PR try to resolve?
clarifies that cargo doc --no-deps will not delete previously-built
dependency docs, and points users to cargo clean --doc or manual
deletion if they want a truly “fresh” doc set. This pr fixed
https://github.com/rust-lang/cargo/issues/15728

### How to test and review this PR?
No testing required.
This commit is contained in:
Weihang Lo 2025-08-15 20:01:27 +00:00 committed by GitHub
commit d1bbe63f64
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 10 additions and 0 deletions

View File

@ -16,6 +16,8 @@ cargo-doc --- Build a package's documentation
Build the documentation for the local package and all dependencies. The output Build the documentation for the local package and all dependencies. The output
is placed in `target/doc` in rustdoc's usual format. is placed in `target/doc` in rustdoc's usual format.
**Note:** Documentation generation is cumulative: existing doc files in the target directory are preserved across different `cargo doc` invocations. To remove existing generated docs, pass `--doc` to {{man "cargo-clean" 1}}.
## OPTIONS ## OPTIONS
### Documentation Options ### Documentation Options

View File

@ -10,6 +10,10 @@ DESCRIPTION
Build the documentation for the local package and all dependencies. The Build the documentation for the local package and all dependencies. The
output is placed in target/doc in rustdocs usual format. output is placed in target/doc in rustdocs usual format.
Note: Documentation generation is cumulative: existing doc files in the
target directory are preserved across different cargo doc invocations.
To remove existing generated docs, pass --doc to cargo-clean(1).
OPTIONS OPTIONS
Documentation Options Documentation Options
--open --open

View File

@ -12,6 +12,8 @@ cargo-doc --- Build a package's documentation
Build the documentation for the local package and all dependencies. The output Build the documentation for the local package and all dependencies. The output
is placed in `target/doc` in rustdoc's usual format. is placed in `target/doc` in rustdoc's usual format.
**Note:** Documentation generation is cumulative: existing doc files in the target directory are preserved across different `cargo doc` invocations. To remove existing generated docs, pass `--doc` to [cargo-clean(1)](cargo-clean.html).
## OPTIONS ## OPTIONS
### Documentation Options ### Documentation Options

View File

@ -10,6 +10,8 @@ cargo\-doc \[em] Build a package\[cq]s documentation
.SH "DESCRIPTION" .SH "DESCRIPTION"
Build the documentation for the local package and all dependencies. The output Build the documentation for the local package and all dependencies. The output
is placed in \fBtarget/doc\fR in rustdoc\[cq]s usual format. is placed in \fBtarget/doc\fR in rustdoc\[cq]s usual format.
.sp
\fBNote:\fR Documentation generation is cumulative: existing doc files in the target directory are preserved across different \fBcargo doc\fR invocations. To remove existing generated docs, pass \fB\-\-doc\fR to \fBcargo\-clean\fR(1).
.SH "OPTIONS" .SH "OPTIONS"
.SS "Documentation Options" .SS "Documentation Options"
.sp .sp