Skip to content

Commit

Permalink
doc(cargo-tree): mention it considering feature unification
Browse files Browse the repository at this point in the history
  • Loading branch information
weihanglo committed Oct 24, 2022
1 parent 071eeaf commit 4a76339
Show file tree
Hide file tree
Showing 4 changed files with 68 additions and 0 deletions.
17 changes: 17 additions & 0 deletions src/doc/man/cargo-tree.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,23 @@ turn depends on `cfg-if` with "default" features. When using `-e features` it
can be helpful to use `-i` flag to show how the features flow into a package.
See the examples below for more detail.

### Feature Unification

This command shows a graph much closer to a feature-unified graph Cargo will
build, rather than what you list in `Cargo.toml`. For instance, if you specify
the same dependency in both `[dependencies]` and `[dev-dependencies]` but with
different features on. This command may merge all features and show a `(*)` on
one of the dependency to indicate the duplicate.

As a result, for a mostly equivalent overview of what `cargo build` does,
`cargo tree -e normal,build` is pretty close; for a mostly equivalent overview
of what `cargo test` does, `cargo tree` is pretty close. However, it doesn't
guarantee the exact equivalence to what Cargo is going to build, since a
compilation is complex and depends on lots of different factors.

To learm more about feature unification, check out this
[dedicated section](../reference/features.html#feature-unification).

## OPTIONS

### Tree Options
Expand Down
19 changes: 19 additions & 0 deletions src/doc/man/generated_txt/cargo-tree.txt
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,25 @@ DESCRIPTION
it can be helpful to use -i flag to show how the features flow into a
package. See the examples below for more detail.

Feature Unification
This command shows a graph much closer to a feature-unified graph Cargo
will build, rather than what you list in Cargo.toml. For instance, if
you specify the same dependency in both [dependencies] and
[dev-dependencies] but with different features on. This command may
merge all features and show a (*) on one of the dependency to indicate
the duplicate.

As a result, for a mostly equivalent overview of what cargo build does,
cargo tree -e normal,build is pretty close; for a mostly equivalent
overview of what cargo test does, cargo tree is pretty close. However,
it doesn't guarantee the exact equivalence to what Cargo is going to
build, since a compilation is complex and depends on lots of different
factors.

To learm more about feature unification, check out this dedicated
section
<https://doc.rust-lang.org/cargo/reference/features.html#feature-unification>.

OPTIONS
Tree Options
-i spec, --invert spec
Expand Down
17 changes: 17 additions & 0 deletions src/doc/src/commands/cargo-tree.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,23 @@ turn depends on `cfg-if` with "default" features. When using `-e features` it
can be helpful to use `-i` flag to show how the features flow into a package.
See the examples below for more detail.

### Feature Unification

This command shows a graph much closer to a feature-unified graph Cargo will
build, rather than what you list in `Cargo.toml`. For instance, if you specify
the same dependency in both `[dependencies]` and `[dev-dependencies]` but with
different features on. This command may merge all features and show a `(*)` on
one of the dependency to indicate the duplicate.

As a result, for a mostly equivalent overview of what `cargo build` does,
`cargo tree -e normal,build` is pretty close; for a mostly equivalent overview
of what `cargo test` does, `cargo tree` is pretty close. However, it doesn't
guarantee the exact equivalence to what Cargo is going to build, since a
compilation is complex and depends on lots of different factors.

To learm more about feature unification, check out this
[dedicated section](../reference/features.html#feature-unification).

## OPTIONS

### Tree Options
Expand Down
15 changes: 15 additions & 0 deletions src/etc/man/cargo-tree.1
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,21 @@ In this tree, \fBmyproject\fR depends on \fBlog\fR with the \fBserde\fR feature.
turn depends on \fBcfg\-if\fR with "default" features. When using \fB\-e features\fR it
can be helpful to use \fB\-i\fR flag to show how the features flow into a package.
See the examples below for more detail.
.SS "Feature Unification"
This command shows a graph much closer to a feature\-unified graph Cargo will
build, rather than what you list in \fBCargo.toml\fR\&. For instance, if you specify
the same dependency in both \fB[dependencies]\fR and \fB[dev\-dependencies]\fR but with
different features on. This command may merge all features and show a \fB(*)\fR on
one of the dependency to indicate the duplicate.
.sp
As a result, for a mostly equivalent overview of what \fBcargo build\fR does,
\fBcargo tree \-e normal,build\fR is pretty close; for a mostly equivalent overview
of what \fBcargo test\fR does, \fBcargo tree\fR is pretty close. However, it doesn't
guarantee the exact equivalence to what Cargo is going to build, since a
compilation is complex and depends on lots of different factors.
.sp
To learm more about feature unification, check out this
\fIdedicated section\fR <https://doc.rust\-lang.org/cargo/reference/features.html#feature\-unification>\&.
.SH "OPTIONS"
.SS "Tree Options"
.sp
Expand Down

0 comments on commit 4a76339

Please sign in to comment.