Skip to content

Commit c1fe920

Browse files
committed
Alt: extend [patch]
1 parent d34db12 commit c1fe920

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

text/3493-precise-pre-release-cargo-update.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,12 +106,26 @@ Put in simple terms the relationship between a pre-release and its stable releas
106106
# Rationale and alternatives
107107
[rationale-and-alternatives]: #rationale-and-alternatives
108108

109+
## Discourage pre-releases
110+
109111
The main alternative to this would be to accept that pre-release versions are not very usable and discourage their use.
110112
Cargo overrides can be used instead using `[patch]`.
111113
These provide a similar experience to pre-releases, however, they require that the library's code is somehow vendored outside of the registry, usually with git.
112114
This can cause issues particularly in CI where jobs may have permission to fetch from a private registry but not from private git repositories.
113115
Resolving issues around not being able to fetch pre-releases from the registry usually wastes a significant amount of time.
114116

117+
## Extend `[patch]`
118+
119+
It could be possible to build upon `[patch]` to [allow it to use crates published in the registry](https://github.com/rust-lang/cargo/issues/9227).
120+
This could be combined with [version overrides](https://github.com/rust-lang/cargo/issues/5640) to pretend that the pre-release crate is a stable version.
121+
122+
My concern with this approach is that it doesn't introduce the concept of compatible pre-releases.
123+
This would allow any version to masquerade as another.
124+
Without the concept of compatible pre-releases there would be no path forward towards being able to express pre-release requirements in library crates.
125+
This is explored in [future-possibilities].
126+
127+
## Pre-releases in `Cargo.toml`
128+
115129
Another alternative would be to resolve pre-release versions in `Cargo.toml`s even when another dependency specifies a stable version.
116130
This is explored in [future-possibilities].
117131
This would require significant changes to the resolver since the latest compatible version would depend on the versions required by other parts of the dependency tree.

0 commit comments

Comments
 (0)