Skip to content

Commit c2a020c

Browse files
authored
Unrolled build for rust-lang#123501
Rollup merge of rust-lang#123501 - Urgau:stabilize-check-cfg, r=petrochenkov Stabilize checking of cfgs at compile-time: `--check-cfg` option This PR stabilize the `--check-cfg` CLI option of `rustc` (and `rustdoc`) 🎉. In particular this PR does two things: 1. it makes the `--check-cfg` option stable 2. and it moves the documentation to the stable books FCP: rust-lang#82450 (comment) Resolves rust-lang#82450 ``@rustbot`` labels +S-blocked +F-check-cfg r? ``@petrochenkov``
2 parents 1dea922 + a20de73 commit c2a020c

File tree

78 files changed

+197
-229
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

78 files changed

+197
-229
lines changed

compiler/rustc_lint/src/context/diagnostics/check_cfg.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ pub(super) fn unexpected_cfg_name(
168168
diag.note("see <https://doc.rust-lang.org/nightly/cargo/reference/unstable.html#check-cfg> for more information about checking conditional configuration");
169169
} else {
170170
diag.help(format!("to expect this configuration use `--check-cfg={inst}`"));
171-
diag.note("see <https://doc.rust-lang.org/nightly/unstable-book/compiler-flags/check-cfg.html> for more information about checking conditional configuration");
171+
diag.note("see <https://doc.rust-lang.org/nightly/rustc/check-cfg.html> for more information about checking conditional configuration");
172172
}
173173
}
174174

@@ -272,6 +272,6 @@ pub(super) fn unexpected_cfg_value(
272272
if !is_cfg_a_well_know_name {
273273
diag.help(format!("to expect this configuration use `--check-cfg={inst}`"));
274274
}
275-
diag.note("see <https://doc.rust-lang.org/nightly/unstable-book/compiler-flags/check-cfg.html> for more information about checking conditional configuration");
275+
diag.note("see <https://doc.rust-lang.org/nightly/rustc/check-cfg.html> for more information about checking conditional configuration");
276276
}
277277
}

compiler/rustc_session/src/config.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1373,7 +1373,7 @@ pub fn rustc_short_optgroups() -> Vec<RustcOptGroup> {
13731373
opt::flag_s("h", "help", "Display this message"),
13741374
opt::multi_s("", "cfg", "Configure the compilation environment.
13751375
SPEC supports the syntax `NAME[=\"VALUE\"]`.", "SPEC"),
1376-
opt::multi("", "check-cfg", "Provide list of valid cfg options for checking", "SPEC"),
1376+
opt::multi_s("", "check-cfg", "Provide list of expected cfgs for checking", "SPEC"),
13771377
opt::multi_s(
13781378
"L",
13791379
"",

compiler/rustc_session/src/config/cfg.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -257,7 +257,7 @@ impl CheckCfg {
257257
// `tests/ui/check-cfg/well-known-values.rs` (in order to test the
258258
// expected values of the new config) and bless the all directory.
259259
//
260-
// Don't forget to update `src/doc/unstable-book/src/compiler-flags/check-cfg.md`
260+
// Don't forget to update `src/doc/rustc/src/check-cfg.md`
261261
// in the unstable book as well!
262262

263263
ins!(sym::debug_assertions, no_values);

src/doc/rustc/src/SUMMARY.md

+1
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@
7777
- [Profile-guided Optimization](profile-guided-optimization.md)
7878
- [Instrumentation-based Code Coverage](instrument-coverage.md)
7979
- [Linker-plugin-based LTO](linker-plugin-lto.md)
80+
- [Checking conditional configurations](check-cfg.md)
8081
- [Exploit Mitigations](exploit-mitigations.md)
8182
- [Symbol Mangling](symbol-mangling/index.md)
8283
- [v0 Symbol Format](symbol-mangling/v0.md)

src/doc/unstable-book/src/compiler-flags/check-cfg.md src/doc/rustc/src/check-cfg.md

+1-7
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,4 @@
1-
# `check-cfg`
2-
3-
The tracking issue for this feature is: [#82450](https://github.com/rust-lang/rust/issues/82450).
4-
5-
------------------------
6-
7-
This feature enables checking of conditional configuration.
1+
# Checking conditional configurations
82

93
`rustc` accepts the `--check-cfg` option, which specifies whether to check conditions and how to
104
check them. The `--check-cfg` option takes a value, called the _check cfg specification_.

src/doc/rustc/src/command-line-arguments.md

+10
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,16 @@ The value can either be a single identifier or two identifiers separated by `=`.
1818
For examples, `--cfg 'verbose'` or `--cfg 'feature="serde"'`. These correspond
1919
to `#[cfg(verbose)]` and `#[cfg(feature = "serde")]` respectively.
2020

21+
<a id="option-check-cfg"></a>
22+
## `--check-cfg`: enables checking conditional configurations
23+
24+
This flag will enable checking conditional configurations.
25+
Refer to the [Checking conditional configurations](check-cfg.md) of this book
26+
for further details and explanation.
27+
28+
For examples, `--check-cfg 'cfg(verbose)'` or `--check-cfg 'cfg(feature, values("serde"))'`.
29+
These correspond to `#[cfg(verbose)]` and `#[cfg(feature = "serde")]` respectively.
30+
2131
<a id="option-l-search-path"></a>
2232
## `-L`: add a directory to the library search path
2333

src/doc/rustdoc/src/command-line-arguments.md

+14
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,20 @@ This flag accepts the same values as `rustc --cfg`, and uses it to configure
131131
compilation. The example above uses `feature`, but any of the `cfg` values
132132
are acceptable.
133133

134+
## `--check-cfg`: check configuration flags
135+
136+
This flag accepts the same values as `rustc --check-cfg`, and uses it to
137+
check configuration flags.
138+
139+
Using this flag looks like this:
140+
141+
```bash
142+
$ rustdoc src/lib.rs --check-cfg='cfg(my_cfg, values("foo", "bar"))'
143+
```
144+
145+
The example above check every well known names and values (`target_os`, `doc`, `test`, ...)
146+
and check the values of `my_cfg`: `foo` and `bar`.
147+
134148
## `--extern`: specify a dependency's location
135149

136150
Using this flag looks like this:

src/doc/rustdoc/src/unstable-features.md

-16
Original file line numberDiff line numberDiff line change
@@ -618,22 +618,6 @@ crate being documented (`foobar`) and a path to output the calls
618618
To scrape examples from test code, e.g. functions marked `#[test]`, then
619619
add the `--scrape-tests` flag.
620620

621-
### `--check-cfg`: check configuration flags
622-
623-
* Tracking issue: [#82450](https://github.com/rust-lang/rust/issues/82450)
624-
625-
This flag accepts the same values as `rustc --check-cfg`, and uses it to check configuration flags.
626-
627-
Using this flag looks like this:
628-
629-
```bash
630-
$ rustdoc src/lib.rs -Z unstable-options \
631-
--check-cfg='cfg(feature, values("foo", "bar"))'
632-
```
633-
634-
The example above check every well known names and values (`target_os`, `doc`, `test`, ...)
635-
and check the values of `feature`: `foo` and `bar`.
636-
637621
### `--generate-link-to-definition`: Generate links on types in source code
638622

639623
* Tracking issue: [#89095](https://github.com/rust-lang/rust/issues/89095)

src/librustdoc/doctest.rs

+2-5
Original file line numberDiff line numberDiff line change
@@ -60,11 +60,8 @@ pub(crate) fn generate_args_file(file_path: &Path, options: &RustdocOptions) ->
6060
for cfg in &options.cfgs {
6161
content.push(format!("--cfg={cfg}"));
6262
}
63-
if !options.check_cfgs.is_empty() {
64-
content.push("-Zunstable-options".to_string());
65-
for check_cfg in &options.check_cfgs {
66-
content.push(format!("--check-cfg={check_cfg}"));
67-
}
63+
for check_cfg in &options.check_cfgs {
64+
content.push(format!("--check-cfg={check_cfg}"));
6865
}
6966

7067
for lib_str in &options.lib_strs {

src/librustdoc/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -242,7 +242,7 @@ fn opts() -> Vec<RustcOptGroup> {
242242
o.optmulti("L", "library-path", "directory to add to crate search path", "DIR")
243243
}),
244244
stable("cfg", |o| o.optmulti("", "cfg", "pass a --cfg to rustc", "")),
245-
unstable("check-cfg", |o| o.optmulti("", "check-cfg", "pass a --check-cfg to rustc", "")),
245+
stable("check-cfg", |o| o.optmulti("", "check-cfg", "pass a --check-cfg to rustc", "")),
246246
stable("extern", |o| o.optmulti("", "extern", "pass an --extern to rustc", "NAME[=PATH]")),
247247
unstable("extern-html-root-url", |o| {
248248
o.optmulti(

tests/rustdoc-ui/check-cfg/check-cfg.rs tests/rustdoc-ui/check-cfg.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
//@ check-pass
2-
//@ compile-flags: --check-cfg=cfg() -Z unstable-options
2+
//@ compile-flags: --check-cfg=cfg()
33

44
/// uniz is nor a builtin nor pass as arguments so is unexpected
55
#[cfg(uniz)]

tests/rustdoc-ui/check-cfg/check-cfg.stderr tests/rustdoc-ui/check-cfg.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ LL | #[cfg(uniz)]
55
| ^^^^ help: there is a config with a similar name: `unix`
66
|
77
= help: to expect this configuration use `--check-cfg=cfg(uniz)`
8-
= note: see <https://doc.rust-lang.org/nightly/unstable-book/compiler-flags/check-cfg.html> for more information about checking conditional configuration
8+
= note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg.html> for more information about checking conditional configuration
99
= note: `#[warn(unexpected_cfgs)]` on by default
1010

1111
warning: 1 warning emitted

tests/rustdoc-ui/check-cfg/check-cfg-test.stderr

-11
This file was deleted.

tests/rustdoc-ui/check-cfg/check-cfg-unstable.rs

-2
This file was deleted.

tests/rustdoc-ui/check-cfg/check-cfg-unstable.stderr

-2
This file was deleted.

tests/rustdoc-ui/doctest/check-cfg-test.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ LL | #[cfg(feature = "invalid")]
66
|
77
= note: expected values for `feature` are: `test`
88
= help: to expect this configuration use `--check-cfg=cfg(feature, values("invalid"))`
9-
= note: see <https://doc.rust-lang.org/nightly/unstable-book/compiler-flags/check-cfg.html> for more information about checking conditional configuration
9+
= note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg.html> for more information about checking conditional configuration
1010
= note: `#[warn(unexpected_cfgs)]` on by default
1111

1212
warning: 1 warning emitted

tests/ui/check-cfg/allow-at-crate-level.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// This test check that #![allow(unexpected_cfgs)] works with --cfg
22
//
33
//@ check-pass
4-
//@ compile-flags: --cfg=unexpected --check-cfg=cfg() -Z unstable-options
4+
//@ compile-flags: --cfg=unexpected --check-cfg=cfg()
55

66
#![allow(unexpected_cfgs)]
77

tests/ui/check-cfg/allow-macro-cfg.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// This test check that local #[allow(unexpected_cfgs)] works
22
//
33
//@ check-pass
4-
//@ compile-flags: --check-cfg=cfg() -Z unstable-options
4+
//@ compile-flags: --check-cfg=cfg()
55

66
#[allow(unexpected_cfgs)]
77
fn foo() {

tests/ui/check-cfg/allow-same-level.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// This test check that #[allow(unexpected_cfgs)] doesn't work if put on the same level
22
//
33
//@ check-pass
4-
//@ compile-flags: --check-cfg=cfg() -Z unstable-options
4+
//@ compile-flags: --check-cfg=cfg()
55

66
#[allow(unexpected_cfgs)]
77
#[cfg(FALSE)]

tests/ui/check-cfg/allow-same-level.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ LL | #[cfg(FALSE)]
66
|
77
= help: expected names are: `clippy`, `debug_assertions`, `doc`, `doctest`, `miri`, `overflow_checks`, `panic`, `proc_macro`, `relocation_model`, `sanitize`, `sanitizer_cfi_generalize_pointers`, `sanitizer_cfi_normalize_integers`, `target_abi`, `target_arch`, `target_endian`, `target_env`, `target_family`, `target_feature`, `target_has_atomic`, `target_has_atomic_equal_alignment`, `target_has_atomic_load_store`, `target_os`, `target_pointer_width`, `target_thread_local`, `target_vendor`, `test`, `ub_checks`, `unix`, `windows`
88
= help: to expect this configuration use `--check-cfg=cfg(FALSE)`
9-
= note: see <https://doc.rust-lang.org/nightly/unstable-book/compiler-flags/check-cfg.html> for more information about checking conditional configuration
9+
= note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg.html> for more information about checking conditional configuration
1010
= note: `#[warn(unexpected_cfgs)]` on by default
1111

1212
warning: 1 warning emitted

tests/ui/check-cfg/allow-top-level.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// This test check that a top-level #![allow(unexpected_cfgs)] works
22
//
33
//@ check-pass
4-
//@ compile-flags: --check-cfg=cfg() -Z unstable-options
4+
//@ compile-flags: --check-cfg=cfg()
55

66
#![allow(unexpected_cfgs)]
77

tests/ui/check-cfg/allow-upper-level.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// This test check that #[allow(unexpected_cfgs)] work if put on an upper level
22
//
33
//@ check-pass
4-
//@ compile-flags: --check-cfg=cfg() -Z unstable-options
4+
//@ compile-flags: --check-cfg=cfg()
55

66
#[allow(unexpected_cfgs)]
77
mod aa {

tests/ui/check-cfg/cargo-feature.none.stderr

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
warning: unexpected `cfg` condition value: `serde`
2-
--> $DIR/cargo-feature.rs:14:7
2+
--> $DIR/cargo-feature.rs:13:7
33
|
44
LL | #[cfg(feature = "serde")]
55
| ^^^^^^^^^^^^^^^^^ help: remove the condition
@@ -10,7 +10,7 @@ LL | #[cfg(feature = "serde")]
1010
= note: `#[warn(unexpected_cfgs)]` on by default
1111

1212
warning: unexpected `cfg` condition value: (none)
13-
--> $DIR/cargo-feature.rs:18:7
13+
--> $DIR/cargo-feature.rs:17:7
1414
|
1515
LL | #[cfg(feature)]
1616
| ^^^^^^^ help: remove the condition
@@ -20,7 +20,7 @@ LL | #[cfg(feature)]
2020
= note: see <https://doc.rust-lang.org/nightly/cargo/reference/unstable.html#check-cfg> for more information about checking conditional configuration
2121

2222
warning: unexpected `cfg` condition name: `tokio_unstable`
23-
--> $DIR/cargo-feature.rs:22:7
23+
--> $DIR/cargo-feature.rs:21:7
2424
|
2525
LL | #[cfg(tokio_unstable)]
2626
| ^^^^^^^^^^^^^^
@@ -30,7 +30,7 @@ LL | #[cfg(tokio_unstable)]
3030
= note: see <https://doc.rust-lang.org/nightly/cargo/reference/unstable.html#check-cfg> for more information about checking conditional configuration
3131

3232
warning: unexpected `cfg` condition name: `CONFIG_NVME`
33-
--> $DIR/cargo-feature.rs:26:7
33+
--> $DIR/cargo-feature.rs:25:7
3434
|
3535
LL | #[cfg(CONFIG_NVME = "m")]
3636
| ^^^^^^^^^^^^^^^^^

tests/ui/check-cfg/cargo-feature.rs

-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
//@ check-pass
66
//@ revisions: some none
77
//@ rustc-env:CARGO_CRATE_NAME=foo
8-
//@ compile-flags: -Z unstable-options
98
//@ [none]compile-flags: --check-cfg=cfg(feature,values())
109
//@ [some]compile-flags: --check-cfg=cfg(feature,values("bitcode"))
1110
//@ [some]compile-flags: --check-cfg=cfg(CONFIG_NVME,values("y"))

tests/ui/check-cfg/cargo-feature.some.stderr

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
warning: unexpected `cfg` condition value: `serde`
2-
--> $DIR/cargo-feature.rs:14:7
2+
--> $DIR/cargo-feature.rs:13:7
33
|
44
LL | #[cfg(feature = "serde")]
55
| ^^^^^^^^^^^^^^^^^
@@ -10,7 +10,7 @@ LL | #[cfg(feature = "serde")]
1010
= note: `#[warn(unexpected_cfgs)]` on by default
1111

1212
warning: unexpected `cfg` condition value: (none)
13-
--> $DIR/cargo-feature.rs:18:7
13+
--> $DIR/cargo-feature.rs:17:7
1414
|
1515
LL | #[cfg(feature)]
1616
| ^^^^^^^- help: specify a config value: `= "bitcode"`
@@ -20,7 +20,7 @@ LL | #[cfg(feature)]
2020
= note: see <https://doc.rust-lang.org/nightly/cargo/reference/unstable.html#check-cfg> for more information about checking conditional configuration
2121

2222
warning: unexpected `cfg` condition name: `tokio_unstable`
23-
--> $DIR/cargo-feature.rs:22:7
23+
--> $DIR/cargo-feature.rs:21:7
2424
|
2525
LL | #[cfg(tokio_unstable)]
2626
| ^^^^^^^^^^^^^^
@@ -30,7 +30,7 @@ LL | #[cfg(tokio_unstable)]
3030
= note: see <https://doc.rust-lang.org/nightly/cargo/reference/unstable.html#check-cfg> for more information about checking conditional configuration
3131

3232
warning: unexpected `cfg` condition value: `m`
33-
--> $DIR/cargo-feature.rs:26:7
33+
--> $DIR/cargo-feature.rs:25:7
3434
|
3535
LL | #[cfg(CONFIG_NVME = "m")]
3636
| ^^^^^^^^^^^^^^---

tests/ui/check-cfg/cfg-value-for-cfg-name-duplicate.rs

-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
// This test checks we won't suggest more than 3 span suggestions for cfg names
33
//
44
//@ check-pass
5-
//@ compile-flags: -Z unstable-options
65
//@ compile-flags: --check-cfg=cfg(foo,values("value")) --check-cfg=cfg(bar,values("value")) --check-cfg=cfg(bee,values("value")) --check-cfg=cfg(cow,values("value"))
76

87
#[cfg(value)]

tests/ui/check-cfg/cfg-value-for-cfg-name-duplicate.stderr

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
warning: unexpected `cfg` condition name: `value`
2-
--> $DIR/cfg-value-for-cfg-name-duplicate.rs:8:7
2+
--> $DIR/cfg-value-for-cfg-name-duplicate.rs:7:7
33
|
44
LL | #[cfg(value)]
55
| ^^^^^
66
|
77
= help: expected names are: `bar`, `bee`, `clippy`, `cow`, `debug_assertions`, `doc`, `doctest`, `foo`, `miri`, `overflow_checks`, `panic`, `proc_macro`, `relocation_model`, `sanitize`, `sanitizer_cfi_generalize_pointers`, `sanitizer_cfi_normalize_integers`, `target_abi`, `target_arch`, `target_endian`, `target_env`, `target_family`, `target_feature`, `target_has_atomic`, `target_has_atomic_equal_alignment`, `target_has_atomic_load_store`, `target_os`, `target_pointer_width`, `target_thread_local`, `target_vendor`, `test`, `ub_checks`, `unix`, `windows`
88
= help: to expect this configuration use `--check-cfg=cfg(value)`
9-
= note: see <https://doc.rust-lang.org/nightly/unstable-book/compiler-flags/check-cfg.html> for more information about checking conditional configuration
9+
= note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg.html> for more information about checking conditional configuration
1010
= note: `#[warn(unexpected_cfgs)]` on by default
1111

1212
warning: 1 warning emitted

tests/ui/check-cfg/cfg-value-for-cfg-name-multiple.rs

-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
// This test checks that when a single cfg has a value for user's specified name
33
//
44
//@ check-pass
5-
//@ compile-flags: -Z unstable-options
65
//@ compile-flags: --check-cfg=cfg(foo,values("my_value")) --check-cfg=cfg(bar,values("my_value"))
76

87
#[cfg(my_value)]

tests/ui/check-cfg/cfg-value-for-cfg-name-multiple.stderr

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
warning: unexpected `cfg` condition name: `my_value`
2-
--> $DIR/cfg-value-for-cfg-name-multiple.rs:8:7
2+
--> $DIR/cfg-value-for-cfg-name-multiple.rs:7:7
33
|
44
LL | #[cfg(my_value)]
55
| ^^^^^^^^
66
|
77
= help: expected names are: `bar`, `clippy`, `debug_assertions`, `doc`, `doctest`, `foo`, `miri`, `overflow_checks`, `panic`, `proc_macro`, `relocation_model`, `sanitize`, `sanitizer_cfi_generalize_pointers`, `sanitizer_cfi_normalize_integers`, `target_abi`, `target_arch`, `target_endian`, `target_env`, `target_family`, `target_feature`, `target_has_atomic`, `target_has_atomic_equal_alignment`, `target_has_atomic_load_store`, `target_os`, `target_pointer_width`, `target_thread_local`, `target_vendor`, `test`, `ub_checks`, `unix`, `windows`
88
= help: to expect this configuration use `--check-cfg=cfg(my_value)`
9-
= note: see <https://doc.rust-lang.org/nightly/unstable-book/compiler-flags/check-cfg.html> for more information about checking conditional configuration
9+
= note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg.html> for more information about checking conditional configuration
1010
= note: `#[warn(unexpected_cfgs)]` on by default
1111
help: found config with similar value
1212
|

tests/ui/check-cfg/cfg-value-for-cfg-name.rs

-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
// suggest to use `#[cfg(target_os = "linux")]` instead of `#[cfg(linux)]`
44
//
55
//@ check-pass
6-
//@ compile-flags: -Z unstable-options
76
//@ compile-flags: --check-cfg=cfg()
87

98
#[cfg(linux)]
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,22 @@
11
warning: unexpected `cfg` condition name: `linux`
2-
--> $DIR/cfg-value-for-cfg-name.rs:9:7
2+
--> $DIR/cfg-value-for-cfg-name.rs:8:7
33
|
44
LL | #[cfg(linux)]
55
| ^^^^^ help: found config with similar value: `target_os = "linux"`
66
|
77
= help: expected names are: `clippy`, `debug_assertions`, `doc`, `doctest`, `miri`, `overflow_checks`, `panic`, `proc_macro`, `relocation_model`, `sanitize`, `sanitizer_cfi_generalize_pointers`, `sanitizer_cfi_normalize_integers`, `target_abi`, `target_arch`, `target_endian`, `target_env`, `target_family`, `target_feature`, `target_has_atomic`, `target_has_atomic_equal_alignment`, `target_has_atomic_load_store`, `target_os`, `target_pointer_width`, `target_thread_local`, `target_vendor`, `test`, `ub_checks`, `unix`, `windows`
88
= help: to expect this configuration use `--check-cfg=cfg(linux)`
9-
= note: see <https://doc.rust-lang.org/nightly/unstable-book/compiler-flags/check-cfg.html> for more information about checking conditional configuration
9+
= note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg.html> for more information about checking conditional configuration
1010
= note: `#[warn(unexpected_cfgs)]` on by default
1111

1212
warning: unexpected `cfg` condition name: `linux`
13-
--> $DIR/cfg-value-for-cfg-name.rs:14:7
13+
--> $DIR/cfg-value-for-cfg-name.rs:13:7
1414
|
1515
LL | #[cfg(linux = "os-name")]
1616
| ^^^^^^^^^^^^^^^^^
1717
|
1818
= help: to expect this configuration use `--check-cfg=cfg(linux, values("os-name"))`
19-
= note: see <https://doc.rust-lang.org/nightly/unstable-book/compiler-flags/check-cfg.html> for more information about checking conditional configuration
19+
= note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg.html> for more information about checking conditional configuration
2020

2121
warning: 2 warnings emitted
2222

0 commit comments

Comments
 (0)