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
@@ -271,9 +255,10 @@ So given `--check-cfg 'cfg(foo, values(since("1.95.0")))'`,
271
255
A new built-in cfg `--cfg=rust --cfg=rust="<version>"` will be added by the compiler
272
256
that specifies the language version.
273
257
This will be the version of `rustc` with the behavior for pre-release versions being unspecified.
274
-
We expect rustc to:
275
-
- Translate the `-nightly` pre-release to `-incomplete`
276
-
- Strip the `-beta.5` pre-release
258
+
We expect rustc to treat beta and nightly versions as an "incomplete" implementation of that language version,
259
+
reporting some number less than the current nightly.
260
+
We could either track the latest patch release at the time of the nightly, assume `x.y.0`, or assume `x.y.99`.
261
+
The compiler may choose to offer an unstable flag to mark a nightly as "complete" to allow for testing of features with `since`.
277
262
278
263
`rust` will be specified as `--check-cfg 'cfg(rust, values(since("1.95.0")))'`
279
264
(or whatever version this gets stabilized in).
@@ -517,7 +502,7 @@ For RFC 2523, they settled on pre-releases being incomplete,
517
502
favoring maintainers to adopt stabilized-on-nightly features immediately
518
503
while letting people on pinned nightlies or bisecting nightlies to set a `-Z` to mark the version as incomplete.
519
504
520
-
In this RFC, we settled on translating`-nightly` to `-incomplete` because:
505
+
Originally, this RFC chose to translate`-nightly` to `-incomplete` because:
521
506
- Maintainers can adopt stabilized-on-nightly features with `#[cfg(since(rust, "1.100.0-0"))]` (the lowest pre-release for `1.100.0`), keeping friction low while explicitly acknowledging that the unstable feature may change
522
507
-`-0` is recommended over `-incomplete` or any other value as the exact pre-release value is unspecified.
523
508
- Allows build scripts to experiment with other logic when approximating the vendor version from the language version with less of a chance of needing to invoke `rustc` (e.g. detecting nightly)
@@ -531,6 +516,9 @@ As for differentiating between nightlies,
531
516
that corresponds more to the vendor version than the language version,
532
517
so we do not include that information.
533
518
519
+
However, we've decided to punt on the question of nightlies to reduce the scope of this RFC
520
+
and out of concern for published packages using unstable features that will automatically get enabled somehow.
521
+
534
522
## Alternative designs
535
523
536
524
### `cfg(rust >= "1.95")`
@@ -874,6 +862,31 @@ We could always relax this incrementally, e.g.
874
862
-`BuildMetadata` for dependency versions
875
863
- Whatever `target_version` requires
876
864
865
+
## Incomplete language versions
866
+
867
+
Rustc could indicate that it implements an incomplete version of the compiler by having an `-incomplete` pre-release field.
868
+
This would be used for nightlies and there would be a question of whether beta should be incomplete or not.
869
+
870
+
This can be done later as its unstable.
871
+
872
+
A guide-level explanation would be:
873
+
874
+
> Say you were wanting to test out `#[must_use]` after it got stabilized on nightly to provide feedback and to be ready
875
+
> for when it hits stable,
876
+
> you would instead use `"1.27.0-0"` to match all pre-release versions of 1.27.0:
877
+
> ```rust
878
+
> #[cfg_attr(since(rust, "1.27.0-0"), must_use)]
879
+
> fndouble(x:i32) ->i32 {
880
+
> 2*x
881
+
> }
882
+
>
883
+
> fnmain() {
884
+
> double(4);
885
+
> // warning: unused return value of `double` which must be used
886
+
> // ^--- This warning only happens if we are on Rust >= 1.27.
0 commit comments