Skip to content

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

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

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions crates/build-rs/src/output.rs
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,8 @@ pub fn rustc_link_arg_bins(flag: &str) {
/// The `rustc-link-arg-tests` instruction tells Cargo to pass the
/// [`-C link-arg=FLAG` option][link-arg] to the compiler, but only when building
/// a tests target.
///
/// [link-arg]: https://doc.rust-lang.org/rustc/codegen-options/index.html#link-arg
#[track_caller]
pub fn rustc_link_arg_tests(flag: &str) {
if flag.contains([' ', '\n']) {
Expand All @@ -130,6 +132,8 @@ pub fn rustc_link_arg_tests(flag: &str) {
/// The `rustc-link-arg-examples` instruction tells Cargo to pass the
/// [`-C link-arg=FLAG` option][link-arg] to the compiler, but only when building
/// an examples target.
///
/// [link-arg]: https://doc.rust-lang.org/rustc/codegen-options/index.html#link-arg
#[track_caller]
pub fn rustc_link_arg_examples(flag: &str) {
if flag.contains([' ', '\n']) {
Expand All @@ -141,6 +145,8 @@ pub fn rustc_link_arg_examples(flag: &str) {
/// The `rustc-link-arg-benches` instruction tells Cargo to pass the
/// [`-C link-arg=FLAG` option][link-arg] to the compiler, but only when building
/// a benchmark target.
///
/// [link-arg]: https://doc.rust-lang.org/rustc/codegen-options/index.html#link-arg
#[track_caller]
pub fn rustc_link_arg_benches(flag: &str) {
if flag.contains([' ', '\n']) {
Expand Down
2 changes: 1 addition & 1 deletion src/cargo/core/compiler/rustdoc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ pub fn add_root_urls(
}

/// Adds unstable flag [`--output-format`][1] to the given `rustdoc`
/// invocation. This is for unstable feature [`-Zunstable-features`].
/// invocation. This is for unstable feature `-Zunstable-features`.
///
/// [1]: https://doc.rust-lang.org/nightly/rustdoc/unstable-features.html?highlight=output-format#-w--output-format-output-format
pub fn add_output_format(
Expand Down
2 changes: 1 addition & 1 deletion src/cargo/util/context/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1982,7 +1982,7 @@ impl GlobalContext {
Ok(())
}

/// Returns a list of [target.'`cfg()`'] tables.
/// Returns a list of `target.'cfg()'` tables.
///
/// The list is sorted by the table name.
pub fn target_cfgs(&self) -> CargoResult<&Vec<(String, TargetCfgConfig)>> {
Expand Down
2 changes: 2 additions & 0 deletions src/doc/man/cargo-doc.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ cargo-doc --- Build a package's documentation
Build the documentation for the local package and all dependencies. The output
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}}.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
**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}}.
**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}}.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, given the file wrap lines at 80 columns, could this follow?


## OPTIONS

### Documentation Options
Expand Down
4 changes: 4 additions & 0 deletions src/doc/man/generated_txt/cargo-doc.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ DESCRIPTION
Build the documentation for the local package and all dependencies. The
output 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).

OPTIONS
Documentation Options
--open
Expand Down
2 changes: 2 additions & 0 deletions src/doc/src/commands/cargo-doc.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ cargo-doc --- Build a package's documentation
Build the documentation for the local package and all dependencies. The output
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

### Documentation Options
Expand Down
2 changes: 2 additions & 0 deletions src/etc/man/cargo-doc.1
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ cargo\-doc \[em] Build a package\[cq]s documentation
.SH "DESCRIPTION"
Build the documentation for the local package and all dependencies. The output
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 cargo doc invocations. To remove existing generated docs, pass \fB\-\-doc\fR to \fBcargo\-clean\fR(1).
.SH "OPTIONS"
.SS "Documentation Options"
.sp
Expand Down
Loading