Skip to content

Detect missing binding available: add a MaybeIncorrect suggestion - #161180

Open
GTimothy wants to merge 1 commit into
rust-lang:mainfrom
GTimothy:detect_missing_binding_available-suggestion
Open

Detect missing binding available: add a MaybeIncorrect suggestion#161180
GTimothy wants to merge 1 commit into
rust-lang:mainfrom
GTimothy:detect_missing_binding_available-suggestion

Conversation

@GTimothy

Copy link
Copy Markdown
Contributor

When suggesting that a missing binding is available in a pattern but not used, if it is behind a .. suggest a MaybeIncorrect fix replacing .. with {binding}, ..

This suggestion could be a tool_only_suggestion, or a span_suggestion_hidden. Other types of suggestions seem a bit too verbose for this simple case.
The tool_only_suggestion (first commit) does not add any suggestion in stderr, the span_suggestion_hidden (second commit) shows a minimal help line.

This work was extracted from PR #156239.

@rustbot rustbot added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Aug 16, 2026
@GTimothy

Copy link
Copy Markdown
Contributor Author

@rustbot r? mu001999

@GTimothy
GTimothy marked this pull request as ready for review August 16, 2026 17:02
@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Aug 16, 2026
@GTimothy

Copy link
Copy Markdown
Contributor Author

@rustbot ready

@mu001999 mu001999 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment thread compiler/rustc_resolve/src/late/diagnostics.rs Outdated
Comment thread compiler/rustc_resolve/src/late/diagnostics.rs Outdated
Comment thread compiler/rustc_resolve/src/late/diagnostics.rs Outdated
Comment thread compiler/rustc_resolve/src/late/diagnostics.rs Outdated
@rustbot rustbot added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Aug 25, 2026
@rustbot

rustbot commented Aug 25, 2026

Copy link
Copy Markdown
Collaborator

Reminder, once the PR becomes ready for a review, use @rustbot ready.

@rust-log-analyzer

This comment has been minimized.

When a pattern has `..` and a matching binding, suggest replacing `..`
with `binding, ..`

bless tests

Co-authored-by: Roland Xu <rcu@live.com>
@GTimothy
GTimothy force-pushed the detect_missing_binding_available-suggestion branch from 2d2e9a5 to eb186bb Compare August 25, 2026 12:18
@GTimothy

Copy link
Copy Markdown
Contributor Author

@rustbot ready

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Aug 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants