Skip to content

Commit 006023c

Browse files
committed
Update from review comments.
1 parent 1ee38a3 commit 006023c

File tree

1 file changed

+13
-7
lines changed

1 file changed

+13
-7
lines changed

src/doc/src/reference/resolver.md

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -213,25 +213,31 @@ the [`perf` feature], then the oldest version it can select is `1.3.0`,
213213
because versions prior to that did not contain the `perf` feature. Similarly,
214214
if a feature is removed from a new release, then packages that require that
215215
feature will be stuck on the older releases that contain that feature. It is
216-
discouraged to remove features in a SemVer-compatible release.
216+
discouraged to remove features in a SemVer-compatible release. Beware that
217+
optional dependencies also define an implicit feature, so removing an optional
218+
dependency or making it non-optional can cause problems, see [removing an
219+
optional dependency].
217220

218221
[`im`]: https://crates.io/crates/im
219222
[`perf` feature]: https://github.com/rust-lang/regex/blob/1.3.0/Cargo.toml#L56
220223
[`rayon` dependency]: https://github.com/bodil/im-rs/blob/v15.0.0/Cargo.toml#L47
221224
[`regex`]: https://crates.io/crates/regex
222225
[`serde` dependency]: https://github.com/bodil/im-rs/blob/v15.0.0/Cargo.toml#L46
223226
[features]: features.md
227+
[removing an optional dependency]: semver.md#cargo-remove-opt-dep
224228
[workspace]: workspaces.md
225229

226230
### `links`
227231

228232
The [`links` field] is used to ensure only one copy of a native library is
229-
linked into a binary. It is an error if multiple SemVer-incompatible versions
230-
of a package with a `links` field appears in the resolve graph. For example,
231-
it is an error if one package depends on [`libgit2-sys`] version `0.11` and
232-
another depends on `0.12`, because Cargo is unable to unify those, but they
233-
both link to the `git2` native library. Due to this rigid requirement, it is
234-
encouraged to be very careful when making SemVer-incompatible releases with
233+
linked into a binary. The resolver will attempt to find a graph where there is
234+
only one instance of each `links` name. If it is unable to find a graph that
235+
satisfies that constraint, it will return an error.
236+
237+
For example, it is an error if one package depends on [`libgit2-sys`] version
238+
`0.11` and another depends on `0.12`, because Cargo is unable to unify those,
239+
but they both link to the `git2` native library. Due to this requirement, it
240+
is encouraged to be very careful when making SemVer-incompatible releases with
235241
the `links` field if your library is in common use.
236242

237243
[`links` field]: manifest.md#the-links-field

0 commit comments

Comments
 (0)