From 4107872f58469cddf2132d4d176f35d4333c32b5 Mon Sep 17 00:00:00 2001 From: Eric Huss Date: Sun, 15 Mar 2020 15:23:10 -0700 Subject: [PATCH] Elaborate on motivation of --unit-graph. --- src/cargo/util/command_prelude.rs | 2 +- src/doc/src/reference/unstable.md | 11 ++++++++++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/src/cargo/util/command_prelude.rs b/src/cargo/util/command_prelude.rs index 0b5dca3a2cf..b3b3a151125 100644 --- a/src/cargo/util/command_prelude.rs +++ b/src/cargo/util/command_prelude.rs @@ -451,7 +451,7 @@ pub trait ArgMatchesExt { if build_config.unit_graph { config .cli_unstable() - .fail_if_stable_opt("--unit-graph", 0)?; + .fail_if_stable_opt("--unit-graph", 8002)?; } let opts = CompileOptions { diff --git a/src/doc/src/reference/unstable.md b/src/doc/src/reference/unstable.md index 307e84acef3..b652d37392b 100644 --- a/src/doc/src/reference/unstable.md +++ b/src/doc/src/reference/unstable.md @@ -554,7 +554,7 @@ The `-Z crate-versions` flag will make `cargo doc` include appropriate crate ver You can find an example screenshot for the cargo itself in the tracking issue. ### unit-graph -* Tracking Issue: TODO +* Tracking Issue: [#8002](https://github.com/rust-lang/cargo/issues/8002) The `--unit-graph` flag can be passed to any build command (`build`, `check`, `run`, `test`, `bench`, `doc`, etc.) to emit a JSON object to stdout which @@ -567,6 +567,15 @@ depends on. cargo +nightly build --unit-graph -Z unstable-options ``` +This structure provides a more complete view of the dependency relationship as +Cargo sees it. In particular, the "features" field supports the new feature +resolver where a dependency can be built multiple times with different +features. `cargo metadata` fundamentally cannot represent the relationship of +features between different dependency kinds, and features now depend on which +command is run and which packages and targets are selected. Additionally it +can provide details about intra-package dependencies like build scripts or +tests. + The following is a description of the JSON structure: ```javascript