rust/compiler/rustc_lint
Matthias Krüger e930ea274e
Rollup merge of #119425 - Urgau:check-cfg-fix-cargo-diag-bug, r=Nilstrieb
Fix invalid check-cfg Cargo feature diagnostic help

#118213 added specialized diagnostic for Cargo `feature` cfg. However when providing an empty `#[cfg(feature)]` condition the suggestion would suggest adding `feature` as a feature in `Cargo.toml` (wtf!).

This PR removes the invalid logic, which even brings a nice improvement.

```diff
   --> $DIR/cargo-feature.rs:18:7
    |
 LL | #[cfg(feature)]
-   |       ^^^^^^^
+   |       ^^^^^^^- help: specify a config value: `= "bitcode"`
    |
    = note: expected values for `feature` are: `bitcode`
-   = help: consider defining `feature` as feature in `Cargo.toml`
```

The first commit add a test showing the bug and the second commit fixes the bug.

`@rustbot` label +F-check-cfg
2023-12-30 11:42:04 +01:00
..
src Rollup merge of #119425 - Urgau:check-cfg-fix-cargo-diag-bug, r=Nilstrieb 2023-12-30 11:42:04 +01:00
Cargo.toml Clean up rustc_*/Cargo.toml. 2023-10-30 08:46:02 +11:00
messages.ftl Add warn-by-default lint against ambiguous wide pointer comparisons 2023-12-06 09:03:48 +01:00