You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
does not address questions around binary operators,
558
+
requiring us to work it out.
559
+
For example, are the sides of the operator fully swappable?
560
+
If we define all comparisons, would `==` be different than `=`?
561
+
How will these operators work in the presence of multiple values or a name-only cfg?
562
+
563
+
Would we allow implicit coercion so you can skip the `version` inside of `cfg`, like `cfg(rust >= "1.95")`?
564
+
I would suggest not because this would make it harder to catch bugs where
565
+
- The `--cfg` is not a version but you thought it was
566
+
- The `--cfg` should be a version but `version()` was left off
567
+
568
+
Currently, check-cfg does not apply at all to `--cfg` because it is commonly used with `RUSTFLAGS` which
569
+
are applied to all packages and would warn that an unknown `IDENTIFIER` is in use for packages that don't care.
570
+
We could still skip checking for unknown `IDENTIFIER`s and instead warn on misuse of `IDENTIFIER`s which would increase the chance of catching a mistake (unless a person duplicated there `--cfg` mistake with `--check-cfg`.
571
+
572
+
Another is how to handle check-cfg.
573
+
The proposed syntax is a binary operator but there is no left-hand side in check-cfg.
574
+
Would we accept `cfg(rust, values(>="1.95"))`?
575
+
How would we specify types? Would we replace `values` with `versions`?
576
+
577
+
Adding typing to cfg,
578
+
while likely something we'll do one day,
579
+
greatly enlarges the scope of this RFC.
580
+
This makes it harder to properly evaluate each part,
581
+
making it more likely we'll make mistakes.
582
+
This further delays the feature as the unstable period is likely to be longer.
583
+
We also are not ready to evaluate other use cases for typing to evaluate the impact
584
+
and likely won't until we move forward with [global features](https://internals.rust-lang.org/t/pre-rfc-mutually-excusive-global-features/19618)
585
+
and `cfg_values!`,
586
+
allowing us to cover use cases like embedded using [toml_cfg](https://crates.io/crates/toml-cfg).
587
+
588
+
If we defer typing, we'll have to allow implicit coercion of values so we can mark `rust` as a version in the future without it being a breaking change.
589
+
590
+
If we consider typing the correct long term solution but defer it,
591
+
we may want to consider the most narrowly scoped solution in the short term,
592
+
like `rust_version("1.95")`.
593
+
These "big questions" can then have dedicated issues and versions can be built on top of that.
594
+
536
595
### `version(rust, ">=1.95")`
537
596
538
597
Instead of having an assumed operator for the predicate,
0 commit comments