Skip to content

Commit ec033c9

Browse files
authored
Version ranges with pre-release upper bounds
1 parent d8db5b1 commit ec033c9

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

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

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -214,6 +214,30 @@ through by modifying `Cargo.toml`.
214214
# Unresolved questions
215215
[unresolved-questions]: #unresolved-questions
216216

217+
# Version ranges with pre-release upper bounds
218+
219+
[As stated earlier](#reference-level-explanation), this RFC proposes that semver version semantics change to encompass pre-release versions.
220+
221+
```
222+
^1.2.3 -> >=1.2.3, <2.0.0-0
223+
```
224+
225+
The addition of an implicit `-0` excludes `2.0.0-<prelease>` releases.
226+
This transformation will also be made when the user explicitly specifies a multiple-version requirement range.
227+
228+
```
229+
>=1.2.3, <2.0.0 -> >=1.2.3, <2.0.0-0
230+
```
231+
232+
This leaves a corner case for `>=0.14-0, <0.14.0`.
233+
Intuitively the user may expect this range to match all `0.14` pre-releases, however, due to the implicit `-0` on the second version requirement, this range will not match any versions.
234+
There are two ways we could go about solving this.
235+
236+
- Only add the implicit `-0` to the upper bound if there is no pre-release on the lower bound.
237+
- Accept the existance of this unexpected behaviour.
238+
239+
Either way, it may be desirable to introduce a dedicated warning for this case.
240+
217241
# Future possibilities
218242
[future-possibilities]: #future-possibilities
219243

0 commit comments

Comments
 (0)