Closed
Description
Problem
When a crate is included a normal dependency and as a dev-dependecies with different features, cargo tree
always show the unified dependencies even if the resolver is set to 2 (resolver = "2 "
). However, the build system properly handle the feature.
The first Cargo.toml
[package]
name = "tt"
version = "0.1.0"
edition = "2021"
resolver = "2"
[dependencies]
te = {path = "../te"}
[dev-dependencies]
te = {path = "../te", features = ["mockall"]}
The second one
[package]
name = "te"
version = "0.1.0"
edition = "2021"
[dependencies]
mockall = {version = "0.11", optional = true}
When looking at the Cargo.lock I see this for the te
crate.
[[package]]
name = "te"
version = "0.1.0"
dependencies = [
"mockall"
]
Running cargo tree yield this
tt v0.1.0 (/home/jbouchard/ws/rust/tt)
`-- te v0.1.0 (/home/jbouchard/ws/rust/te)
|-- mockall v0.11.3
| |-- cfg-if v1.0.0
| |-- downcast v0.11.0
| |-- fragile v2.0.0
| |-- lazy_static v1.4.0
| |-- mockall_derive v0.11.3 (proc-macro)
| | |-- cfg-if v1.0.0
| | |-- proc-macro2 v1.0.47
| | | `-- unicode-ident v1.0.5
| | |-- quote v1.0.21
| | | `-- proc-macro2 v1.0.47 (*)
| | `-- syn v1.0.102
| | |-- proc-macro2 v1.0.47 (*)
| | |-- quote v1.0.21 (*)
| | `-- unicode-ident v1.0.5
| |-- predicates v2.1.1
| | |-- difflib v0.4.0
| | |-- float-cmp v0.9.0
| | | `-- num-traits v0.2.15
| | | [build-dependencies]
| | | `-- autocfg v1.1.0
| | |-- itertools v0.10.5
| | | `-- either v1.8.0
| | |-- normalize-line-endings v0.3.0
| | |-- predicates-core v1.0.3
| | `-- regex v1.6.0
| | |-- aho-corasick v0.7.19
| | | `-- memchr v2.5.0
| | |-- memchr v2.5.0
| | `-- regex-syntax v0.6.27
| `-- predicates-tree v1.0.5
| |-- predicates-core v1.0.3
| `-- termtree v0.2.4
[dev-dependencies]
`-- te v0.1.0 (/home/jbouchard/ws/rust/te) (*)
Steps
No response
Possible Solution(s)
No response
Notes
No response
Version
cargo 1.66.0-nightly (3ff044334 2022-10-17)
release: 1.66.0-nightly
commit-hash: 3ff044334f0567ce1481c78603aeee7211b91623
commit-date: 2022-10-17
host: x86_64-unknown-linux-gnu
libgit2: 1.5.0 (sys:0.15.0 vendored)
libcurl: 7.83.1-DEV (sys:0.4.55+curl-7.83.1 vendored ssl:OpenSSL/1.1.1q)
os: Debian 11 (bullseye) [64-bit]