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
Auto merge of rust-lang#119473 - Urgau:check-cfg-explicit-none, r=petrochenkov
Add explicit `none()` value variant in check-cfg
This PR adds an explicit none value variant in check-cfg values: `values(none())`.
Currently the only way to define the none variant is with an empty `values()` which means that if someone has a cfg that takes none and strings they need to use two invocations: `--check-cfg=cfg(foo) --check-cfg=cfg(foo, values("bar"))`.
Which would now be `--check-cfg=cfg(foo, values(none(),"bar"))`, this is simpler and easier to understand.
`--check-cfg=cfg(foo)`, `--check-cfg=cfg(foo, values())` and `--check-cfg=cfg(foo, values(none()))` would be equivalent.
*Another motivation for doing this is to make empty `values()` actually means no-values, but this is orthogonal to this PR and adding `none()` is sufficient in it-self.*
`@rustbot` label +F-check-cfg
r? `@petrochenkov`
= help: to expect this configuration use `--check-cfg=cfg(foo, values("too"))`
11
+
= note: see <https://doc.rust-lang.org/nightly/unstable-book/compiler-flags/check-cfg.html> for more information about checking conditional configuration
12
+
= note: `#[warn(unexpected_cfgs)]` on by default
13
+
14
+
warning: unexpected `cfg` condition value: `bar`
15
+
--> $DIR/values-none.rs:16:7
16
+
|
17
+
LL | #[cfg(foo = "bar")]
18
+
| ^^^--------
19
+
| |
20
+
| help: remove the value
21
+
|
22
+
= note: no expected value for `foo`
23
+
= help: to expect this configuration use `--check-cfg=cfg(foo, values("bar"))`
24
+
= note: see <https://doc.rust-lang.org/nightly/unstable-book/compiler-flags/check-cfg.html> for more information about checking conditional configuration
= help: to expect this configuration use `--check-cfg=cfg(foo, values("too"))`
11
+
= note: see <https://doc.rust-lang.org/nightly/unstable-book/compiler-flags/check-cfg.html> for more information about checking conditional configuration
12
+
= note: `#[warn(unexpected_cfgs)]` on by default
13
+
14
+
warning: unexpected `cfg` condition value: `bar`
15
+
--> $DIR/values-none.rs:16:7
16
+
|
17
+
LL | #[cfg(foo = "bar")]
18
+
| ^^^--------
19
+
| |
20
+
| help: remove the value
21
+
|
22
+
= note: no expected value for `foo`
23
+
= help: to expect this configuration use `--check-cfg=cfg(foo, values("bar"))`
24
+
= note: see <https://doc.rust-lang.org/nightly/unstable-book/compiler-flags/check-cfg.html> for more information about checking conditional configuration
0 commit comments