Skip to content

Commit

Permalink
Fix invalid check-cfg Cargo feature diagnostic help
Browse files Browse the repository at this point in the history
  • Loading branch information
Urgau authored and quininer committed Dec 31, 2023
1 parent 72a7707 commit e95b1f8
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 4 deletions.
2 changes: 0 additions & 2 deletions compiler/rustc_lint/src/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -804,8 +804,6 @@ pub trait LintContext {
db.span_suggestion(value_span, "there is a expected value with a similar name", format!("\"{best_match}\""), Applicability::MaybeIncorrect);

}
} else if name == sym::feature && is_from_cargo {
db.help(format!("consider defining `{name}` as feature in `Cargo.toml`"));
} else if let &[first_possibility] = &possibilities[..] {
db.span_suggestion(name_span.shrink_to_hi(), "specify a config value", format!(" = \"{first_possibility}\""), Applicability::MaybeIncorrect);
}
Expand Down
3 changes: 1 addition & 2 deletions tests/ui/check-cfg/cargo-feature.some.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,9 @@ warning: unexpected `cfg` condition value: (none)
--> $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`
= note: see <https://doc.rust-lang.org/nightly/cargo/reference/unstable.html#check-cfg> for more information about checking conditional configuration

warning: unexpected `cfg` condition name: `tokio_unstable`
Expand Down

0 comments on commit e95b1f8

Please sign in to comment.