Skip to content

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

Merged
rust-bors[bot] merged 1 commit into
rust-lang:mainfrom
GTimothy:detect_missing_binding_available-suggestion
Aug 25, 2026
Merged

Detect missing binding available: add a MaybeIncorrect suggestion#161180
rust-bors[bot] merged 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
@mu001999

Copy link
Copy Markdown
Member

Thanks!

@bors r+ rollup

@rust-bors

rust-bors Bot commented Aug 25, 2026

Copy link
Copy Markdown
Contributor

📌 Commit eb186bb has been approved by mu001999

It is now in the queue for this repository.

@rust-bors rust-bors Bot added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Aug 25, 2026
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Aug 25, 2026
…ailable-suggestion, r=mu001999

Detect missing binding available: add a MaybeIncorrect suggestion

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 rust-lang#156239.
rust-bors Bot pushed a commit that referenced this pull request Aug 25, 2026
…uwer

Rollup of 13 pull requests

Successful merges:

 - #158874 (hir_ty_lowering: fix anon const type recovery)
 - #161443 (add internal DSL for testing binders)
 - #161617 (Add custom allocators to `(try_)map` on `Box`, `Rc`, `Arc`)
 - #161726 (Fix debugger visualizer tuple child ordering w/ PDB debug info)
 - #161729 (miri subtree update)
 - #161745 (make trivial ABI check resilient against new repr)
 - #160871 (Remove `#[rustc_reservation_impl]`)
 - #161180 (Detect missing binding available: add a MaybeIncorrect suggestion)
 - #161522 (test `f16::mul_add` not double-rounding the result)
 - #161631 (Add two comments relating to new-solver performance)
 - #161724 (Add codegen test for static table search loop unrolling)
 - #161740 (do not compress debuginfo for Cygwin)
 - #161750 (vector ABI check: reword so it makes more sense for non-obviously-vector types)
@rust-bors
rust-bors Bot merged commit 07d9787 into rust-lang:main Aug 25, 2026
13 checks passed
@rustbot rustbot added this to the 1.100.0 milestone Aug 25, 2026
rust-bors Bot pushed a commit that referenced this pull request Aug 25, 2026
Rollup merge of #161180 - GTimothy:detect_missing_binding_available-suggestion, r=mu001999

Detect missing binding available: add a MaybeIncorrect suggestion

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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. 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