Skip to content

Commit 26f87f1

Browse files
joshtriplettehuss
authored andcommitted
Don't unify features across targets
1 parent ba7a4ba commit 26f87f1

File tree

1 file changed

+14
-16
lines changed

1 file changed

+14
-16
lines changed

text/3176-cargo-multi-dep-artifacts.md

Lines changed: 14 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -78,9 +78,9 @@ specified by `CARGO_BIN_DIR_EXAMPLE_ARM`.
7878
[reference-level-explanation]: #reference-level-explanation
7979

8080
Cargo allows specifying multiple dependencies on the same crate, as long as all
81-
such dependencies resolve to the same version with the same features, and have
82-
different dependency names specified. Cargo will make the dependency available
83-
under each specified name.
81+
such dependencies resolve to the same version, and have different dependency
82+
names specified. Cargo will make the dependency available under each specified
83+
name.
8484

8585
Multiple artifact dependencies on the same crate may have different `target`
8686
fields. In this case, cargo will build the dependency for each specified
@@ -94,13 +94,17 @@ containing the artifacts (e.g. `CARGO_BIN_DIR_EXAMPLE`) and
9494
determines the `<DEP>`, but does not affect the `<NAME>` of each artifact
9595
within that dependency.
9696

97-
Cargo will unify features and versions across all kinds of dependencies,
98-
including multiple artifact dependencies, just as it does for multiple
99-
dependencies on the same crate throughout a dependency tree. A dependency tree
100-
may only include one semver-compatible version of a given crate, but may
101-
include multiple semver-incompatible versions of a given crate. Dependency
102-
versions need not be textually identical, as long as they resolve to the same
103-
version.
97+
Cargo will unify versions across all kinds of dependencies, including multiple
98+
artifact dependencies, just as it does for multiple dependencies on the same
99+
crate throughout a dependency tree. A dependency tree may only include one
100+
semver-compatible version of a given crate, but may include multiple
101+
semver-incompatible versions of a given crate. Dependency versions need not be
102+
textually identical, as long as they resolve to the same version.
103+
104+
Cargo will not unify features across dependencies for different targets. One
105+
dependency tree may have both ordinary dependencies and multiple artifact
106+
dependencies on the same crate, with different features for the ordinary
107+
dependency and for artifact depenencies for different targets.
104108

105109
Building an artifact dependency for multiple targets may entail building
106110
multiple copies of other dependencies, which must similarly unify within a
@@ -165,12 +169,6 @@ harm to the primary use case.
165169
# Future possibilities
166170
[future-possibilities]: #future-possibilities
167171

168-
In some cases, a crate may want to depend on a binary without unifying features
169-
or dependency versions with that binary. A future extension to this mechanism
170-
could allow cargo to build multiple copies of a binary crate for different
171-
targets without attempting to do any unification. This would allow enabling
172-
different sets of features for different targets.
173-
174172
This RFC does not provide a means of specifying different profile overrides for
175173
different dependencies on the same crate. A future extension to this mechanism
176174
could take the dependency name or target into account and allow specifying

0 commit comments

Comments
 (0)