Fix invalid check-cfg Cargo feature diagnostic help#119425
Merged
bors merged 2 commits intorust-lang:masterfrom Dec 30, 2023
Merged
Fix invalid check-cfg Cargo feature diagnostic help#119425bors merged 2 commits intorust-lang:masterfrom
bors merged 2 commits intorust-lang:masterfrom
Conversation
Collaborator
|
(rustbot has picked a reviewer for you, use r? to override) |
Noratrieb
reviewed
Dec 30, 2023
| 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 { |
Member
There was a problem hiding this comment.
unrelated comment, but I feel like all of this logic should be moved to a separate module instead of being in this big match
Member
Author
There was a problem hiding this comment.
I've put up #119443 to address this suggestion
Noratrieb
approved these changes
Dec 30, 2023
Member
|
r=me when CI is happy |
Collaborator
|
✌️ @Urgau, you can now approve this pull request! If @Nilstrieb told you to " |
Member
Author
Collaborator
bors
added a commit
to rust-lang-ci/rust
that referenced
this pull request
Dec 30, 2023
…iaskrgr Rollup of 5 pull requests Successful merges: - rust-lang#119158 (Clean up alloc::sync::Weak Clone implementation) - rust-lang#119386 (fix typo in `IpAddr::to_canonical`) - rust-lang#119413 (solaris support on bootstrap lock) - rust-lang#119424 (Primitive docs: fix confusing `Send` in `&T`'s list) - rust-lang#119425 (Fix invalid check-cfg Cargo feature diagnostic help) r? `@ghost` `@rustbot` modify labels: rollup
rust-timer
added a commit
to rust-lang-ci/rust
that referenced
this pull request
Dec 30, 2023
Rollup merge of rust-lang#119425 - Urgau:check-cfg-fix-cargo-diag-bug, r=Nilstrieb Fix invalid check-cfg Cargo feature diagnostic help rust-lang#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
bors
added a commit
to rust-lang-ci/rust
that referenced
this pull request
Dec 30, 2023
…xt, r=Nilstrieb Move around the code responsible for decorating builtin diagnostics This PR move the code responsible for decorating builtin diagnostics into a separate sub-module for ease of use and readability. While my original intention was to also move the check-cfg unexpected logic in their own function I changed my mind after moving the match altogether. I can move those if desired. Fixes rust-lang#119425 (comment) r? `@Nilstrieb`
bors
added a commit
to rust-lang-ci/rust
that referenced
this pull request
Dec 30, 2023
…xt, r=Nilstrieb Move around the code responsible for decorating builtin diagnostics This PR move the code responsible for decorating builtin diagnostics into a separate sub-module for ease of use and readability. While my original intention was to also move the check-cfg unexpected logic in their own function I changed my mind after moving the match altogether. I can move those if desired. Fixes rust-lang#119425 (comment) r? `@Nilstrieb`
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
#118213 added specialized diagnostic for Cargo
featurecfg. However when providing an empty#[cfg(feature)]condition the suggestion would suggest addingfeatureas a feature inCargo.toml(wtf!).This PR removes the invalid logic, which even brings a nice improvement.
--> $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