Skip to content

Commit 62b6d5a

Browse files
committed
Auto merge of #11282 - weihanglo:doc/cargo-tree, r=epage
doc(cargo-tree): mention it considering feature unification
2 parents 19d37d2 + 4a76339 commit 62b6d5a

File tree

4 files changed

+68
-0
lines changed

4 files changed

+68
-0
lines changed

src/doc/man/cargo-tree.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,23 @@ turn depends on `cfg-if` with "default" features. When using `-e features` it
5353
can be helpful to use `-i` flag to show how the features flow into a package.
5454
See the examples below for more detail.
5555

56+
### Feature Unification
57+
58+
This command shows a graph much closer to a feature-unified graph Cargo will
59+
build, rather than what you list in `Cargo.toml`. For instance, if you specify
60+
the same dependency in both `[dependencies]` and `[dev-dependencies]` but with
61+
different features on. This command may merge all features and show a `(*)` on
62+
one of the dependency to indicate the duplicate.
63+
64+
As a result, for a mostly equivalent overview of what `cargo build` does,
65+
`cargo tree -e normal,build` is pretty close; for a mostly equivalent overview
66+
of what `cargo test` does, `cargo tree` is pretty close. However, it doesn't
67+
guarantee the exact equivalence to what Cargo is going to build, since a
68+
compilation is complex and depends on lots of different factors.
69+
70+
To learm more about feature unification, check out this
71+
[dedicated section](../reference/features.html#feature-unification).
72+
5673
## OPTIONS
5774

5875
### Tree Options

src/doc/man/generated_txt/cargo-tree.txt

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,25 @@ DESCRIPTION
4444
it can be helpful to use -i flag to show how the features flow into a
4545
package. See the examples below for more detail.
4646

47+
Feature Unification
48+
This command shows a graph much closer to a feature-unified graph Cargo
49+
will build, rather than what you list in Cargo.toml. For instance, if
50+
you specify the same dependency in both [dependencies] and
51+
[dev-dependencies] but with different features on. This command may
52+
merge all features and show a (*) on one of the dependency to indicate
53+
the duplicate.
54+
55+
As a result, for a mostly equivalent overview of what cargo build does,
56+
cargo tree -e normal,build is pretty close; for a mostly equivalent
57+
overview of what cargo test does, cargo tree is pretty close. However,
58+
it doesn't guarantee the exact equivalence to what Cargo is going to
59+
build, since a compilation is complex and depends on lots of different
60+
factors.
61+
62+
To learm more about feature unification, check out this dedicated
63+
section
64+
<https://doc.rust-lang.org/cargo/reference/features.html#feature-unification>.
65+
4766
OPTIONS
4867
Tree Options
4968
-i spec, --invert spec

src/doc/src/commands/cargo-tree.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,23 @@ turn depends on `cfg-if` with "default" features. When using `-e features` it
5353
can be helpful to use `-i` flag to show how the features flow into a package.
5454
See the examples below for more detail.
5555

56+
### Feature Unification
57+
58+
This command shows a graph much closer to a feature-unified graph Cargo will
59+
build, rather than what you list in `Cargo.toml`. For instance, if you specify
60+
the same dependency in both `[dependencies]` and `[dev-dependencies]` but with
61+
different features on. This command may merge all features and show a `(*)` on
62+
one of the dependency to indicate the duplicate.
63+
64+
As a result, for a mostly equivalent overview of what `cargo build` does,
65+
`cargo tree -e normal,build` is pretty close; for a mostly equivalent overview
66+
of what `cargo test` does, `cargo tree` is pretty close. However, it doesn't
67+
guarantee the exact equivalence to what Cargo is going to build, since a
68+
compilation is complex and depends on lots of different factors.
69+
70+
To learm more about feature unification, check out this
71+
[dedicated section](../reference/features.html#feature-unification).
72+
5673
## OPTIONS
5774

5875
### Tree Options

src/etc/man/cargo-tree.1

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

0 commit comments

Comments
 (0)