From 50fd163e932379aa4ffaff24468dff3ff915b468 Mon Sep 17 00:00:00 2001 From: Kevin Reid Date: Thu, 13 Mar 2025 19:03:45 -0700 Subject: [PATCH 1/2] Mention `x.y.*` as a kind of version requirement to avoid. `x.y.*` is equivalent to `>=x.y.0, [#10599]). > > Avoid constraining the upper bound of a version to be anything less than the -> next semver incompatible version -> (e.g. avoid `">=2.0, <2.4"`) as other packages in the dependency tree may +> next semver incompatible version (e.g. avoid `">=2.0, <2.4"` or `"2.0.*"`), +> as other packages in the dependency tree may > require a newer version, leading to an unresolvable error (see [#9029]). > Consider whether controlling the version in your [`Cargo.lock`] would be more > appropriate. > > In some instances this won't matter or the benefits might outweigh the cost, including: -> - When no one else depends on your package e.g. it only has a `[[bin]]` +> - When no one else depends on your package; e.g. it only has a `[[bin]]` > - When depending on a pre-release package and wishing to avoid breaking -> changes then a fully specified `"=1.2.3-alpha.3"` might be warranted (see +> changes, then a fully specified `"=1.2.3-alpha.3"` might be warranted (see > [#2222]) > - When a library re-exports a proc-macro but the proc-macro generates code that -> calls into the re-exporting library then a fully specified `=1.2.3` might be +> calls into the re-exporting library, then a fully specified `=1.2.3` might be > warranted to ensure the proc-macro isn't newer than the re-exporting library > and generating code that uses parts of the API that don't exist within the > current version From c0cc00390bdd61830f7974fd8459c99302c72e70 Mon Sep 17 00:00:00 2001 From: Kevin Reid Date: Thu, 13 Mar 2025 21:18:29 -0700 Subject: [PATCH 2/2] Also mention tilde requirements. --- src/doc/src/reference/specifying-dependencies.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/doc/src/reference/specifying-dependencies.md b/src/doc/src/reference/specifying-dependencies.md index 6430ec70f1e..9eb2c467995 100644 --- a/src/doc/src/reference/specifying-dependencies.md +++ b/src/doc/src/reference/specifying-dependencies.md @@ -162,7 +162,8 @@ is ignored and should not be used in version requirements. > [#10599]). > > Avoid constraining the upper bound of a version to be anything less than the -> next semver incompatible version (e.g. avoid `">=2.0, <2.4"` or `"2.0.*"`), +> next semver incompatible version +> (e.g. avoid `">=2.0, <2.4"`, `"2.0.*"`, or `~2.0`), > as other packages in the dependency tree may > require a newer version, leading to an unresolvable error (see [#9029]). > Consider whether controlling the version in your [`Cargo.lock`] would be more