diff options
| author | bors <bors@rust-lang.org> | 2023-12-13 19:45:57 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2023-12-13 19:45:57 +0000 |
| commit | a90372c6e80cde01018b5486b27eefe66c629068 (patch) | |
| tree | 87a345aba6b0c9f40ba77147fce7ce5a3c864ee1 /tests/rustdoc-ui | |
| parent | 2862500152d89996ab2b682f22ed7e8923396992 (diff) | |
| parent | f6617d050d831cd2f1ad41a71731568a5e5e2c12 (diff) | |
| download | rust-a90372c6e80cde01018b5486b27eefe66c629068.tar.gz rust-a90372c6e80cde01018b5486b27eefe66c629068.zip | |
Auto merge of #118213 - Urgau:check-cfg-diagnostics-rustc-cargo, r=petrochenkov
Add more suggestions to unexpected cfg names and values
This pull request adds more suggestion to unexpected cfg names and values diagnostics:
- it first adds a links to the [rustc unstable book](https://doc.rust-lang.org/nightly/unstable-book/compiler-flags/check-cfg.html) or the [Cargo reference](https://doc.rust-lang.org/nightly/cargo/reference/unstable.html#check-cfg), depending if rustc is invoked by Cargo
- it secondly adds a suggestion on how to expect the cfg name or value:
*excluding well known names and values*
- for Cargo: it suggest using a feature or `cargo:rust-check-cfg` in build script
- for rustc: it suggest using `--check-cfg` (with the correct invocation)
Those diagnostics improvements are directed towards enabling users to fix the issue if the previous suggestions weren't good enough.
r? `@petrochenkov`
Diffstat (limited to 'tests/rustdoc-ui')
| -rw-r--r-- | tests/rustdoc-ui/check-cfg/check-cfg.stderr | 2 | ||||
| -rw-r--r-- | tests/rustdoc-ui/doctest/check-cfg-test.stderr | 2 |
2 files changed, 4 insertions, 0 deletions
diff --git a/tests/rustdoc-ui/check-cfg/check-cfg.stderr b/tests/rustdoc-ui/check-cfg/check-cfg.stderr index d010c1f7ec6..3bca5dd0834 100644 --- a/tests/rustdoc-ui/check-cfg/check-cfg.stderr +++ b/tests/rustdoc-ui/check-cfg/check-cfg.stderr @@ -4,6 +4,8 @@ warning: unexpected `cfg` condition name: `uniz` LL | #[cfg(uniz)] | ^^^^ help: there is a config with a similar name: `unix` | + = help: to expect this configuration use `--check-cfg=cfg(uniz)` + = note: see <https://doc.rust-lang.org/nightly/unstable-book/compiler-flags/check-cfg.html> for more information about checking conditional configuration = note: `#[warn(unexpected_cfgs)]` on by default warning: 1 warning emitted diff --git a/tests/rustdoc-ui/doctest/check-cfg-test.stderr b/tests/rustdoc-ui/doctest/check-cfg-test.stderr index 0bfd569e381..5524f582d56 100644 --- a/tests/rustdoc-ui/doctest/check-cfg-test.stderr +++ b/tests/rustdoc-ui/doctest/check-cfg-test.stderr @@ -5,6 +5,8 @@ LL | #[cfg(feature = "invalid")] | ^^^^^^^^^^^^^^^^^^^ | = note: expected values for `feature` are: `test` + = help: to expect this configuration use `--check-cfg=cfg(feature, values("invalid"))` + = note: see <https://doc.rust-lang.org/nightly/unstable-book/compiler-flags/check-cfg.html> for more information about checking conditional configuration = note: `#[warn(unexpected_cfgs)]` on by default warning: 1 warning emitted |
