Skip to content

Commit 75c486b

Browse files
committed
fix(rationale): Include another benefit for non-semver erroring
1 parent 2c3cbe4 commit 75c486b

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

text/3857-cfg-version.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -362,12 +362,14 @@ While having a specific name avoids these concerns.
362362
We could swap the order of parameters and make `rust` a default for the second parameter to allow `#[cfg(since("1.95"))]` as a shorthand.
363363
However, this would look confusing in Cargo and doesn't seem like its offering enough of a benefit to be worth the costs.
364364

365-
`ConfigurationSince` requires the `IDENTIFIER` and string literal to be a SemVer version
365+
`ConfigurationSince` requires the `IDENTIFIER` and string literal to be a SemVer version,
366+
erroring otherwise,
366367
so we can have the flexibility to relax the syntax over time without it being a breaking change
367368
For example, if `--cfg=foo="1.0"` caused `cfg(since(foo, "1.0"))` to be `false` and we later allowed `"1.0"` for the `IDENTIFIER`, it would now be `true` and would change behavior.
368369
Because we'll have `since(rust, _)` at that point, it won't require an MSRV bump.
369370
This does leave the door open for us to relax this in the future once we become comfortable with the flexibility of our version syntax.
370371
Alternatively, we could try to determine a flexible-enough version syntax now though that comes with the risk that it isn't sufficient.
372+
Another benefit to erroring is so `not(since(invalid, "<invalid>"))` is not `true`.
371373

372374
If we were stricter on the syntax,
373375
we could allow for version numbers to be directly accepted, without quotes

0 commit comments

Comments
 (0)