Skip to content

Commit dcf6853

Browse files
committed
Update Cargo diagnostics in check-cfg
1 parent 7dd170f commit dcf6853

File tree

4 files changed

+25
-25
lines changed

4 files changed

+25
-25
lines changed

Diff for: compiler/rustc_lint/src/context/diagnostics/check_cfg.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -164,9 +164,9 @@ pub(super) fn unexpected_cfg_name(
164164

165165
if is_from_cargo {
166166
if !is_feature_cfg {
167-
diag.help(format!("consider using a Cargo feature instead or adding `println!(\"cargo:rustc-check-cfg={inst}\");` to the top of a `build.rs`"));
167+
diag.help(format!("consider using a Cargo feature instead or adding `println!(\"cargo::rustc-check-cfg={inst}\");` to the top of the `build.rs`"));
168168
}
169-
diag.note("see <https://doc.rust-lang.org/nightly/cargo/reference/unstable.html#check-cfg> for more information about checking conditional configuration");
169+
diag.note("see <https://doc.rust-lang.org/nightly/cargo/reference/build-scripts.html#rustc-check-cfg> for more information about checking conditional configuration");
170170
} else {
171171
diag.help(format!("to expect this configuration use `--check-cfg={inst}`"));
172172
diag.note("see <https://doc.rust-lang.org/nightly/rustc/check-cfg.html> for more information about checking conditional configuration");
@@ -266,9 +266,9 @@ pub(super) fn unexpected_cfg_value(
266266
diag.help("consider defining some features in `Cargo.toml`");
267267
}
268268
} else if !is_cfg_a_well_know_name {
269-
diag.help(format!("consider using a Cargo feature instead or adding `println!(\"cargo:rustc-check-cfg={inst}\");` to the top of a `build.rs`"));
269+
diag.help(format!("consider using a Cargo feature instead or adding `println!(\"cargo::rustc-check-cfg={inst}\");` to the top of the `build.rs`"));
270270
}
271-
diag.note("see <https://doc.rust-lang.org/nightly/cargo/reference/unstable.html#check-cfg> for more information about checking conditional configuration");
271+
diag.note("see <https://doc.rust-lang.org/nightly/cargo/reference/build-scripts.html#rustc-check-cfg> for more information about checking conditional configuration");
272272
} else {
273273
if !is_cfg_a_well_know_name {
274274
diag.help(format!("to expect this configuration use `--check-cfg={inst}`"));

Diff for: tests/ui/check-cfg/cargo-feature.none.stderr

+6-6
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ LL | #[cfg(feature = "serde")]
66
|
77
= note: no expected values for `feature`
88
= help: consider adding `serde` as a feature in `Cargo.toml`
9-
= note: see <https://doc.rust-lang.org/nightly/cargo/reference/unstable.html#check-cfg> for more information about checking conditional configuration
9+
= note: see <https://doc.rust-lang.org/nightly/cargo/reference/build-scripts.html#rustc-check-cfg> for more information about checking conditional configuration
1010
= note: `#[warn(unexpected_cfgs)]` on by default
1111

1212
warning: unexpected `cfg` condition value: (none)
@@ -17,7 +17,7 @@ LL | #[cfg(feature)]
1717
|
1818
= note: no expected values for `feature`
1919
= help: consider defining some features in `Cargo.toml`
20-
= note: see <https://doc.rust-lang.org/nightly/cargo/reference/unstable.html#check-cfg> for more information about checking conditional configuration
20+
= note: see <https://doc.rust-lang.org/nightly/cargo/reference/build-scripts.html#rustc-check-cfg> for more information about checking conditional configuration
2121

2222
warning: unexpected `cfg` condition name: `tokio_unstable`
2323
--> $DIR/cargo-feature.rs:22:7
@@ -26,17 +26,17 @@ LL | #[cfg(tokio_unstable)]
2626
| ^^^^^^^^^^^^^^
2727
|
2828
= help: expected names are: `clippy`, `debug_assertions`, `doc`, `doctest`, `feature`, `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`
29-
= help: consider using a Cargo feature instead or adding `println!("cargo:rustc-check-cfg=cfg(tokio_unstable)");` to the top of a `build.rs`
30-
= note: see <https://doc.rust-lang.org/nightly/cargo/reference/unstable.html#check-cfg> for more information about checking conditional configuration
29+
= help: consider using a Cargo feature instead or adding `println!("cargo::rustc-check-cfg=cfg(tokio_unstable)");` to the top of the `build.rs`
30+
= note: see <https://doc.rust-lang.org/nightly/cargo/reference/build-scripts.html#rustc-check-cfg> for more information about checking conditional configuration
3131

3232
warning: unexpected `cfg` condition name: `CONFIG_NVME`
3333
--> $DIR/cargo-feature.rs:26:7
3434
|
3535
LL | #[cfg(CONFIG_NVME = "m")]
3636
| ^^^^^^^^^^^^^^^^^
3737
|
38-
= help: consider using a Cargo feature instead or adding `println!("cargo:rustc-check-cfg=cfg(CONFIG_NVME, values(\"m\"))");` to the top of a `build.rs`
39-
= note: see <https://doc.rust-lang.org/nightly/cargo/reference/unstable.html#check-cfg> for more information about checking conditional configuration
38+
= help: consider using a Cargo feature instead or adding `println!("cargo::rustc-check-cfg=cfg(CONFIG_NVME, values(\"m\"))");` to the top of the `build.rs`
39+
= note: see <https://doc.rust-lang.org/nightly/cargo/reference/build-scripts.html#rustc-check-cfg> for more information about checking conditional configuration
4040

4141
warning: 4 warnings emitted
4242

Diff for: tests/ui/check-cfg/cargo-feature.some.stderr

+6-6
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ LL | #[cfg(feature = "serde")]
66
|
77
= note: expected values for `feature` are: `bitcode`
88
= help: consider adding `serde` as a feature in `Cargo.toml`
9-
= note: see <https://doc.rust-lang.org/nightly/cargo/reference/unstable.html#check-cfg> for more information about checking conditional configuration
9+
= note: see <https://doc.rust-lang.org/nightly/cargo/reference/build-scripts.html#rustc-check-cfg> for more information about checking conditional configuration
1010
= note: `#[warn(unexpected_cfgs)]` on by default
1111

1212
warning: unexpected `cfg` condition value: (none)
@@ -17,7 +17,7 @@ LL | #[cfg(feature)]
1717
|
1818
= note: expected values for `feature` are: `bitcode`
1919
= help: consider defining some features in `Cargo.toml`
20-
= note: see <https://doc.rust-lang.org/nightly/cargo/reference/unstable.html#check-cfg> for more information about checking conditional configuration
20+
= note: see <https://doc.rust-lang.org/nightly/cargo/reference/build-scripts.html#rustc-check-cfg> for more information about checking conditional configuration
2121

2222
warning: unexpected `cfg` condition name: `tokio_unstable`
2323
--> $DIR/cargo-feature.rs:22:7
@@ -26,8 +26,8 @@ LL | #[cfg(tokio_unstable)]
2626
| ^^^^^^^^^^^^^^
2727
|
2828
= help: expected names are: `CONFIG_NVME`, `clippy`, `debug_assertions`, `doc`, `doctest`, `feature`, `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`
29-
= help: consider using a Cargo feature instead or adding `println!("cargo:rustc-check-cfg=cfg(tokio_unstable)");` to the top of a `build.rs`
30-
= note: see <https://doc.rust-lang.org/nightly/cargo/reference/unstable.html#check-cfg> for more information about checking conditional configuration
29+
= help: consider using a Cargo feature instead or adding `println!("cargo::rustc-check-cfg=cfg(tokio_unstable)");` to the top of the `build.rs`
30+
= note: see <https://doc.rust-lang.org/nightly/cargo/reference/build-scripts.html#rustc-check-cfg> for more information about checking conditional configuration
3131

3232
warning: unexpected `cfg` condition value: `m`
3333
--> $DIR/cargo-feature.rs:26:7
@@ -38,8 +38,8 @@ LL | #[cfg(CONFIG_NVME = "m")]
3838
| help: there is a expected value with a similar name: `"y"`
3939
|
4040
= note: expected values for `CONFIG_NVME` are: `y`
41-
= help: consider using a Cargo feature instead or adding `println!("cargo:rustc-check-cfg=cfg(CONFIG_NVME, values(\"m\"))");` to the top of a `build.rs`
42-
= note: see <https://doc.rust-lang.org/nightly/cargo/reference/unstable.html#check-cfg> for more information about checking conditional configuration
41+
= help: consider using a Cargo feature instead or adding `println!("cargo::rustc-check-cfg=cfg(CONFIG_NVME, values(\"m\"))");` to the top of the `build.rs`
42+
= note: see <https://doc.rust-lang.org/nightly/cargo/reference/build-scripts.html#rustc-check-cfg> for more information about checking conditional configuration
4343

4444
warning: 4 warnings emitted
4545

Diff for: tests/ui/check-cfg/diagnotics.cargo.stderr

+9-9
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ LL | #[cfg(featur)]
55
| ^^^^^^ help: there is a config with a similar name: `feature`
66
|
77
= help: expected values for `feature` are: `foo`
8-
= note: see <https://doc.rust-lang.org/nightly/cargo/reference/unstable.html#check-cfg> for more information about checking conditional configuration
8+
= note: see <https://doc.rust-lang.org/nightly/cargo/reference/build-scripts.html#rustc-check-cfg> for more information about checking conditional configuration
99
= note: `#[warn(unexpected_cfgs)]` on by default
1010

1111
warning: unexpected `cfg` condition name: `featur`
@@ -14,7 +14,7 @@ warning: unexpected `cfg` condition name: `featur`
1414
LL | #[cfg(featur = "foo")]
1515
| ^^^^^^^^^^^^^^
1616
|
17-
= note: see <https://doc.rust-lang.org/nightly/cargo/reference/unstable.html#check-cfg> for more information about checking conditional configuration
17+
= note: see <https://doc.rust-lang.org/nightly/cargo/reference/build-scripts.html#rustc-check-cfg> for more information about checking conditional configuration
1818
help: there is a config with a similar name and value
1919
|
2020
LL | #[cfg(feature = "foo")]
@@ -27,7 +27,7 @@ LL | #[cfg(featur = "fo")]
2727
| ^^^^^^^^^^^^^
2828
|
2929
= help: expected values for `feature` are: `foo`
30-
= note: see <https://doc.rust-lang.org/nightly/cargo/reference/unstable.html#check-cfg> for more information about checking conditional configuration
30+
= note: see <https://doc.rust-lang.org/nightly/cargo/reference/build-scripts.html#rustc-check-cfg> for more information about checking conditional configuration
3131
help: there is a config with a similar name and different values
3232
|
3333
LL | #[cfg(feature = "foo")]
@@ -39,17 +39,17 @@ warning: unexpected `cfg` condition name: `no_value`
3939
LL | #[cfg(no_value)]
4040
| ^^^^^^^^ help: there is a config with a similar name: `no_values`
4141
|
42-
= help: consider using a Cargo feature instead or adding `println!("cargo:rustc-check-cfg=cfg(no_value)");` to the top of a `build.rs`
43-
= note: see <https://doc.rust-lang.org/nightly/cargo/reference/unstable.html#check-cfg> for more information about checking conditional configuration
42+
= help: consider using a Cargo feature instead or adding `println!("cargo::rustc-check-cfg=cfg(no_value)");` to the top of the `build.rs`
43+
= note: see <https://doc.rust-lang.org/nightly/cargo/reference/build-scripts.html#rustc-check-cfg> for more information about checking conditional configuration
4444

4545
warning: unexpected `cfg` condition name: `no_value`
4646
--> $DIR/diagnotics.rs:27:7
4747
|
4848
LL | #[cfg(no_value = "foo")]
4949
| ^^^^^^^^^^^^^^^^
5050
|
51-
= help: consider using a Cargo feature instead or adding `println!("cargo:rustc-check-cfg=cfg(no_value, values(\"foo\"))");` to the top of a `build.rs`
52-
= note: see <https://doc.rust-lang.org/nightly/cargo/reference/unstable.html#check-cfg> for more information about checking conditional configuration
51+
= help: consider using a Cargo feature instead or adding `println!("cargo::rustc-check-cfg=cfg(no_value, values(\"foo\"))");` to the top of the `build.rs`
52+
= note: see <https://doc.rust-lang.org/nightly/cargo/reference/build-scripts.html#rustc-check-cfg> for more information about checking conditional configuration
5353
help: there is a config with a similar name and no value
5454
|
5555
LL | #[cfg(no_values)]
@@ -64,8 +64,8 @@ LL | #[cfg(no_values = "bar")]
6464
| help: remove the value
6565
|
6666
= note: no expected value for `no_values`
67-
= help: consider using a Cargo feature instead or adding `println!("cargo:rustc-check-cfg=cfg(no_values, values(\"bar\"))");` to the top of a `build.rs`
68-
= note: see <https://doc.rust-lang.org/nightly/cargo/reference/unstable.html#check-cfg> for more information about checking conditional configuration
67+
= help: consider using a Cargo feature instead or adding `println!("cargo::rustc-check-cfg=cfg(no_values, values(\"bar\"))");` to the top of the `build.rs`
68+
= note: see <https://doc.rust-lang.org/nightly/cargo/reference/build-scripts.html#rustc-check-cfg> for more information about checking conditional configuration
6969

7070
warning: 6 warnings emitted
7171

0 commit comments

Comments
 (0)