Skip to content

Commit 4107872

Browse files
committed
Elaborate on motivation of --unit-graph.
1 parent aa80a98 commit 4107872

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

src/cargo/util/command_prelude.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -451,7 +451,7 @@ pub trait ArgMatchesExt {
451451
if build_config.unit_graph {
452452
config
453453
.cli_unstable()
454-
.fail_if_stable_opt("--unit-graph", 0)?;
454+
.fail_if_stable_opt("--unit-graph", 8002)?;
455455
}
456456

457457
let opts = CompileOptions {

src/doc/src/reference/unstable.md

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -554,7 +554,7 @@ The `-Z crate-versions` flag will make `cargo doc` include appropriate crate ver
554554
You can find an example screenshot for the cargo itself in the tracking issue.
555555

556556
### unit-graph
557-
* Tracking Issue: TODO
557+
* Tracking Issue: [#8002](https://github.com/rust-lang/cargo/issues/8002)
558558

559559
The `--unit-graph` flag can be passed to any build command (`build`, `check`,
560560
`run`, `test`, `bench`, `doc`, etc.) to emit a JSON object to stdout which
@@ -567,6 +567,15 @@ depends on.
567567
cargo +nightly build --unit-graph -Z unstable-options
568568
```
569569

570+
This structure provides a more complete view of the dependency relationship as
571+
Cargo sees it. In particular, the "features" field supports the new feature
572+
resolver where a dependency can be built multiple times with different
573+
features. `cargo metadata` fundamentally cannot represent the relationship of
574+
features between different dependency kinds, and features now depend on which
575+
command is run and which packages and targets are selected. Additionally it
576+
can provide details about intra-package dependencies like build scripts or
577+
tests.
578+
570579
The following is a description of the JSON structure:
571580

572581
```javascript

0 commit comments

Comments
 (0)