Skip to content

Commit 9be4594

Browse files
committed
Auto merge of #6990 - notriddle:patch-1, r=ehuss
Add some hints to the docs for `cfg()` targets https://users.rust-lang.org/t/what-cfg-expressions-are-expected-to-work-in-cargo-toml-quoted-targets/28662
2 parents a7648c7 + 69f9adb commit 9be4594

File tree

1 file changed

+14
-3
lines changed

1 file changed

+14
-3
lines changed

src/doc/src/reference/specifying-dependencies.md

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -440,7 +440,8 @@ Cargo how to find local unpublished crates.
440440

441441

442442
Platform-specific dependencies take the same format, but are listed under a
443-
`target` section. Normally Rust-like `#[cfg]` syntax will be used to define
443+
`target` section. Normally Rust-like [`#[cfg]`
444+
syntax](../reference/conditional-compilation.html) will be used to define
444445
these sections:
445446

446447
```toml
@@ -458,8 +459,18 @@ native = { path = "native/x86_64" }
458459
```
459460

460461
Like with Rust, the syntax here supports the `not`, `any`, and `all` operators
461-
to combine various cfg name/value pairs. Note that the `cfg` syntax has only
462-
been available since Cargo 0.9.0 (Rust 1.8.0).
462+
to combine various cfg name/value pairs.
463+
464+
If you want to know which cfg targets are available on your platform, run
465+
`rustc --print=cfg` from the command line. If you want to know which `cfg`
466+
targets are available for another platform, such as 64-bit Windows,
467+
run `rustc --print=cfg --target=x86_64-pc-windows-msvc`.
468+
469+
Unlike in your Rust source code,
470+
you cannot use `[target.'cfg(feature = "my_crate")'.dependencies]` to add
471+
dependencies based on optional crate features.
472+
Use [the `[features]` section](reference/manifest.html#the-features-section)
473+
instead.
463474

464475
In addition to `#[cfg]` syntax, Cargo also supports listing out the full target
465476
the dependencies would apply to:

0 commit comments

Comments
 (0)