Commit 6096481
committed
cargo: include the implicit feature for dependencies in the manifest
Make the implicit `xyz = ["dep:xyz"]` declaration explicit in the Manifest.
This also makes it possible to implement correctly the part of the spec where
"If you specify the optional dependency with the dep: prefix anywhere in
the [features] table, that disables the implicit feature."
Unfortunately, this can only be done after target-specific configurations
are resolved, which makes it hard to write a unit test for this. Rustix
requires it, though; without this patch, something like
[package]
name = "rustix"
edition = "2021"
rust-version = "1.63"
version = "0.38.34"
[dependencies]
alloc = { version = "1.0.0", optional = true, package = "rustc-std-workspace-alloc" }
libc = { version = "0.2.0", optional = true, package = "libc" }
libc_errno = { version = "0.3.8", optional = true, package = "errno" }
[features]
alloc = []
default = ["std"]
rustc-dep-of-std = ["dep:alloc"]
std = ["alloc"]
use-libc = ["libc_errno", "libc"]
would incorrectly request the rustc-std-workspace-alloc crate via the
chain default->std->alloc. The patch blocks it because it finds the
"dep:alloc" dependency of feature rustc-dep-of-std.
Signed-off-by: Paolo Bonzini <[email protected]>1 parent a90592a commit 6096481
1 file changed
+15
-3
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
| 15 | + | |
15 | 16 | | |
16 | 17 | | |
17 | 18 | | |
| |||
428 | 429 | | |
429 | 430 | | |
430 | 431 | | |
| 432 | + | |
| 433 | + | |
| 434 | + | |
| 435 | + | |
| 436 | + | |
| 437 | + | |
| 438 | + | |
| 439 | + | |
| 440 | + | |
| 441 | + | |
| 442 | + | |
| 443 | + | |
| 444 | + | |
| 445 | + | |
431 | 446 | | |
432 | 447 | | |
433 | 448 | | |
| |||
499 | 514 | | |
500 | 515 | | |
501 | 516 | | |
502 | | - | |
503 | | - | |
504 | | - | |
505 | 517 | | |
506 | 518 | | |
507 | 519 | | |
| |||
0 commit comments