Skip to content

Commit c5e9d5f

Browse files
committed
Misc cleanup
1 parent a1a8164 commit c5e9d5f

File tree

1 file changed

+15
-11
lines changed

1 file changed

+15
-11
lines changed

text/3857-cfg-version.md

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -258,7 +258,7 @@ This will be reported back through `--print-cfg`.
258258
Because this gets reported back in `--print-cfg`,
259259
Cargo will expose `rust` in:
260260
- build scripts as `CARGO_CFG_RUST`
261-
- `target."cfg()".dependencies`
261+
- `[target."cfg()".dependencies]`
262262

263263
## clippy
264264

@@ -268,7 +268,7 @@ However, it will be perfectly reasonable to use those items when guarded by a `#
268268

269269
Clippy may wish to:
270270
- Find a way to reduce false positives, e.g. evaluating the `cfg(since)`s that led to the item's usage or disabling the lint within `#[cfg(since)]`
271-
- Suggest `#[cfg(since)]` in the `clippy::incompatible_msrv` diagnostic report (maybe along with offering to bump MSRV)
271+
- Suggest `#[cfg(since)]` in the `clippy::incompatible_msrv` diagnostic report (maybe along with offering to bump MSRV as that is a reasonable alternative)
272272

273273
# Drawbacks
274274
[drawbacks]: #drawbacks
@@ -292,7 +292,7 @@ Libraries could having ticking time bombs that accidentally break or have undesi
292292

293293
## `since` cfg predicate
294294

295-
We could offer a `before` operator but that is already covered by `not(since)`.
295+
We could offer a `before` predicate but that is already covered by `not(since)`.
296296

297297
The `since` name was taken from
298298
[rustversion](https://crates.io/crates/rustversion) and the `#[deprecated(since)]` / `#[stable(since)]` attributes.
@@ -331,11 +331,11 @@ in case we want the future possibility of relaxing SemVer versions
331331
We could have the `check-cfg` `since` predicate only apply to the `cfg` `since` predicate,
332332
causing `#[cfg(rust = "1.100.0")]` to warn.
333333
However,
334-
- the `since` predicates are a general feature intended to be used with other version numbers where exact matches may be appropriate.
334+
- the `since` predicates are a general feature intended to be used with other version numbers where exact matches may also be appropriate.
335335
- this would get in the way of approximating the vendor version by the language version for working around compiler bugs and snapshotting of compiler output.
336336

337337
Possibly there could be a clippy lint specifically about `rust = "<something>"`.
338-
Alternatively, we could try to find a way to structure `--check-cfg` to allow the person defining the `cfg` to decide whether it can be use with `=` or not.
338+
Alternatively, we could try to find a way to structure `--check-cfg` to allow the person defining the `cfg` to decide whether it can be used with `=` or not.
339339
One way of doing this is by allowing the `check-cfg` `since` predicate outside of the `values` predicate,
340340
meaning it works with the `cfg` `since` predicate and not the `=` operator.
341341
Another way would be for the `check-cfg` `since` predicate to never work with `=` but to instead
@@ -363,7 +363,7 @@ To allow checking for the presence of `rust`, add the following to your `Cargo.t
363363
[lints.rust]
364364
unexpected_cfgs = { level = "warn", check-cfg = ['cfg(rust,values(none()))'] }
365365
```
366-
Alternatively, we could have the built-in `--check-cfg` include `values(none())` but:
366+
Alternatively, we could have the built-in `--check-cfg` for `rust` include `values(none())` but:
367367
- When building on an old version, users will see the warning and will likely want to add it anyways.
368368
- We lose out on `--check-cfg` identifying misused.
369369
Instead, we may wish to add a dedicated predicate intended for "is set".
@@ -373,12 +373,16 @@ Alternatively, we could have the built-in `--check-cfg` include `values(none())`
373373
While there was concern over `rust` appearing in the name of `cfg(rust_version("1.95"))`,
374374
I feel that `rust` as its own entity makes sense and avoids that problem.
375375

376+
Rust does appear in some parts of the language,
377+
but is capitalized like with [`repr(Rust)`](https://doc.rust-lang.org/reference/type-layout.html?#the-rust-representation).
378+
However, the convention for `--cfg`s is generally lower case.
379+
376380
### Pre-release
377381

378-
When translating `rustc --version` to a Language version, we have several choices when it comes to pre-releases, including:
379-
- Treat the nightly as fully implementing that Language version
380-
- Treat the nightly as not implementing that Language version at all, only the previous
381-
- Leave a marker that that Language version is incomplete, while the previous Language version is complete
382+
When translating `rustc --version` to a language version, we have several choices when it comes to pre-releases, including:
383+
- Treat the nightly as fully implementing that language version
384+
- Treat the nightly as not implementing that language version at all, only the previous
385+
- Leave a marker that that language version is incomplete, while the previous language version is complete
382386

383387
In RFC 2523, this was left as an
384388
[unresolved question](https://rust-lang.github.io/rfcs/2523-cfg-path-version.html#unresolved-questions).
@@ -400,7 +404,7 @@ For RFC 2523, they settled on pre-releases being incomplete,
400404
favoring maintainers to adopt stabilized-on-nightly features immediately
401405
while letting people on pinned nightlies or bisecting nightlies to set a `-Z` to mark the version as incomplete.
402406

403-
In this RFC, we settled translating `-nightly` to `-incomplete` because:
407+
In this RFC, we settled on translating `-nightly` to `-incomplete` because:
404408
- 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
405409
- Allows build scripts to experiment with other logic without less chance of needing to invoke `rustc` (e.g. detecting nightly)
406410
- It provides extra context when approximating the vendor version from the language version when populating build information

0 commit comments

Comments
 (0)