Repository navigation
Commit ec744d0
committed
fix: a partial caret or tilde requirement treats unwritten segments as wildcards
`^0` and `^0.0` bounded their range at 0.0.1, and `~1` and `~0` at 1.1
and 0.1. The caret branch chose the segment to bump through major(),
minor() and patch(), which read a segment that was never written as 0,
so `^0` fell through to bumping the patch; the tilde branch always
bumped the minor. A dependency written `"^0"` against an index with
0.3.0 and 0.4.0 failed with "matches none of", and `"~1"` never
selected 1.1.0 or later.
The grammar is Cargo's, and Cargo reads an unwritten segment as a
wildcard: `^0` is >=0.0.0, <1.0.0; `^0.0` is >=0.0.0, <0.1.0; `~1` is
>=1.0.0, <2.0.0. mcpp.xpkg_version already bounds a partial caret this
way. The caret bound now bumps the leftmost non-zero segment, looking no
further than the patch and stopping at the last segment written; the
tilde bound holds the major alone when no minor is written. Every fully
written requirement (`^0.0.0`, `^0.0.3`, `^1.2.3`, `~1.2`, the
four-segment date versions) keeps its bound.
Unit tests cover the partial caret and tilde forms next to the existing
caret and tilde cases, and docs/05-dependencies.md (both languages)
lists the two forms.
Closes #8641 parent db3b815 commit ec744d0
4 files changed
Lines changed: 73 additions & 8 deletions
File tree
- docs
- zh
- modules/versioning/src
- tests/unit
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
115 | 115 | | |
116 | 116 | | |
117 | 117 | | |
| 118 | + | |
| 119 | + | |
118 | 120 | | |
119 | 121 | | |
120 | 122 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
105 | 105 | | |
106 | 106 | | |
107 | 107 | | |
| 108 | + | |
| 109 | + | |
108 | 110 | | |
109 | 111 | | |
110 | 112 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
| 7 | + | |
| 8 | + | |
7 | 9 | | |
8 | 10 | | |
9 | 11 | | |
| |||
372 | 374 | | |
373 | 375 | | |
374 | 376 | | |
375 | | - | |
376 | | - | |
| 377 | + | |
| 378 | + | |
| 379 | + | |
| 380 | + | |
| 381 | + | |
| 382 | + | |
| 383 | + | |
377 | 384 | | |
378 | 385 | | |
379 | 386 | | |
| |||
385 | 392 | | |
386 | 393 | | |
387 | 394 | | |
388 | | - | |
389 | | - | |
390 | | - | |
| 395 | + | |
| 396 | + | |
| 397 | + | |
| 398 | + | |
| 399 | + | |
391 | 400 | | |
392 | 401 | | |
393 | 402 | | |
394 | 403 | | |
395 | 404 | | |
| 405 | + | |
| 406 | + | |
396 | 407 | | |
397 | 408 | | |
398 | | - | |
399 | | - | |
400 | | - | |
| 409 | + | |
| 410 | + | |
| 411 | + | |
401 | 412 | | |
402 | 413 | | |
403 | 414 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
64 | 64 | | |
65 | 65 | | |
66 | 66 | | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
67 | 117 | | |
68 | 118 | | |
69 | 119 | | |
| |||
0 commit comments