Skip to content

Tweak irrefutable let else warning output#154325

Merged
rust-bors[bot] merged 1 commit intorust-lang:mainfrom
WeiTheShinobi:tweak-let-else-output
Apr 28, 2026
Merged

Tweak irrefutable let else warning output#154325
rust-bors[bot] merged 1 commit intorust-lang:mainfrom
WeiTheShinobi:tweak-let-else-output

Conversation

@WeiTheShinobi
Copy link
Copy Markdown
Contributor

Fixes #153454

Greeting!
This PR tweak diagnostic output for irrefutable-let-else patterns and adds a check for let a = Some(b) else {...}
Thanks for the review!

help: consider using `let Some(name) = case` to match on a specific variant
   |
LL -     let name = Some(case) else {
LL +     let Some(name) = case else {
   |

@rustbot
Copy link
Copy Markdown
Collaborator

rustbot commented Mar 24, 2026

Some changes occurred in match checking

cc @Nadrieril

@rustbot rustbot added 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. labels Mar 24, 2026
@rustbot
Copy link
Copy Markdown
Collaborator

rustbot commented Mar 24, 2026

r? @davidtwco

rustbot has assigned @davidtwco.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

Why was this reviewer chosen?

The reviewer was selected based on:

  • Owners of files modified in this PR: compiler
  • compiler expanded to 69 candidates
  • Random selection from 13 candidates

@WeiTheShinobi WeiTheShinobi force-pushed the tweak-let-else-output branch from f9c1661 to 94d6023 Compare March 24, 2026 17:06
@rust-log-analyzer

This comment has been minimized.

@WeiTheShinobi WeiTheShinobi marked this pull request as draft March 24, 2026 17:48
@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 Mar 24, 2026
@WeiTheShinobi WeiTheShinobi force-pushed the tweak-let-else-output branch from 94d6023 to 254a0c7 Compare March 28, 2026 17:56
@WeiTheShinobi WeiTheShinobi marked this pull request as ready for review March 28, 2026 20:01
@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 Mar 28, 2026
@rust-bors

This comment has been minimized.

@WeiTheShinobi WeiTheShinobi force-pushed the tweak-let-else-output branch from 254a0c7 to adc87de Compare April 1, 2026 12:54
@rustbot
Copy link
Copy Markdown
Collaborator

rustbot commented Apr 1, 2026

This PR was rebased onto a different main commit. Here's a range-diff highlighting what actually changed.

Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers.

Comment thread compiler/rustc_mir_build/src/errors.rs Outdated
code = "let {lhs} = {rhs}",
applicability = "machine-applicable"
)]
pub(crate) struct BeReplacedLetElse {
Copy link
Copy Markdown
Member

@davidtwco davidtwco Apr 10, 2026

Choose a reason for hiding this comment

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

View changes since the review

Suggested change
pub(crate) struct BeReplacedLetElse {
pub(crate) struct LetElseReplacementSuggestion {

Comment thread tests/ui/expr/if/if-let.stderr Outdated
|
LL | } else if let a = 1 {
| ^^^^^^^^^
| ^
Copy link
Copy Markdown
Member

@davidtwco davidtwco Apr 10, 2026

Choose a reason for hiding this comment

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

View changes since the review

I prefer the previous spans in these diagnostics

@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 Apr 10, 2026
@rustbot
Copy link
Copy Markdown
Collaborator

rustbot commented Apr 10, 2026

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

@WeiTheShinobi WeiTheShinobi force-pushed the tweak-let-else-output branch from adc87de to 8591f0f Compare April 18, 2026 05:04
@WeiTheShinobi
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 Apr 18, 2026
@davidtwco
Copy link
Copy Markdown
Member

@bors r+

@rust-bors
Copy link
Copy Markdown
Contributor

rust-bors Bot commented Apr 28, 2026

📌 Commit 8591f0f has been approved by davidtwco

It is now in the queue for this repository.

@rust-bors rust-bors Bot added the S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. label Apr 28, 2026
@rust-bors rust-bors Bot removed the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Apr 28, 2026
jhpratt added a commit to jhpratt/rust that referenced this pull request Apr 28, 2026
…t, r=davidtwco

Tweak irrefutable let else warning output

Fixes rust-lang#153454

Greeting!
This PR tweak diagnostic output for `irrefutable-let-else` patterns and adds a check for `let a = Some(b) else {...}`
Thanks for the review!

```
help: consider using `let Some(name) = case` to match on a specific variant
   |
LL -     let name = Some(case) else {
LL +     let Some(name) = case else {
   |
```
rust-bors Bot pushed a commit that referenced this pull request Apr 28, 2026
Rollup of 5 pull requests

Successful merges:

 - #154325 (Tweak irrefutable let else warning output)
 - #155273 (Lock stable_crate_ids once in create_crate_num)
 - #155692 (disable naked-dead-code-elimination test if no RET mnemonic is available)
 - #155747 (Update documentation for `wasm32-wali-linux-musl` after integrating n…)
 - #155907 (Handle hkl const closures)
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Apr 28, 2026
…t, r=davidtwco

Tweak irrefutable let else warning output

Fixes rust-lang#153454

Greeting!
This PR tweak diagnostic output for `irrefutable-let-else` patterns and adds a check for `let a = Some(b) else {...}`
Thanks for the review!

```
help: consider using `let Some(name) = case` to match on a specific variant
   |
LL -     let name = Some(case) else {
LL +     let Some(name) = case else {
   |
```
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Apr 28, 2026
…t, r=davidtwco

Tweak irrefutable let else warning output

Fixes rust-lang#153454

Greeting!
This PR tweak diagnostic output for `irrefutable-let-else` patterns and adds a check for `let a = Some(b) else {...}`
Thanks for the review!

```
help: consider using `let Some(name) = case` to match on a specific variant
   |
LL -     let name = Some(case) else {
LL +     let Some(name) = case else {
   |
```
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Apr 28, 2026
…t, r=davidtwco

Tweak irrefutable let else warning output

Fixes rust-lang#153454

Greeting!
This PR tweak diagnostic output for `irrefutable-let-else` patterns and adds a check for `let a = Some(b) else {...}`
Thanks for the review!

```
help: consider using `let Some(name) = case` to match on a specific variant
   |
LL -     let name = Some(case) else {
LL +     let Some(name) = case else {
   |
```
rust-bors Bot pushed a commit that referenced this pull request Apr 28, 2026
…uwer

Rollup of 12 pull requests

Successful merges:

 - #151994 (switch to v0 mangling by default on stable)
 - #154325 (Tweak irrefutable let else warning output)
 - #155899 (`dlltool`: Set the working directory to workaround `--temp-prefix` bug)
 - #155273 (Lock stable_crate_ids once in create_crate_num)
 - #155361 (Document that CFI diverges from Rust wrt. ABI-compatibility rules)
 - #155692 (disable naked-dead-code-elimination test if no RET mnemonic is available)
 - #155747 (Update documentation for `wasm32-wali-linux-musl` after integrating n…)
 - #155768 (compiletest: Overhaul the code for running an incremental test revision)
 - #155907 (Handle hkl const closures)
 - #155910 (misc stuff from reading borrowck again :))
 - #155913 (Delete the 12 year old fixme)
 - #155920 (remove review queue triagebot mentions)
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Apr 28, 2026
…t, r=davidtwco

Tweak irrefutable let else warning output

Fixes rust-lang#153454

Greeting!
This PR tweak diagnostic output for `irrefutable-let-else` patterns and adds a check for `let a = Some(b) else {...}`
Thanks for the review!

```
help: consider using `let Some(name) = case` to match on a specific variant
   |
LL -     let name = Some(case) else {
LL +     let Some(name) = case else {
   |
```
rust-bors Bot pushed a commit that referenced this pull request Apr 28, 2026
…uwer

Rollup of 14 pull requests

Successful merges:

 - #155850 (Only exclude the #155473 change for 1-byte bool-likes)
 - #155923 (Subtree sync for rustc_codegen_cranelift)
 - #151994 (switch to v0 mangling by default on stable)
 - #154325 (Tweak irrefutable let else warning output)
 - #155899 (`dlltool`: Set the working directory to workaround `--temp-prefix` bug)
 - #155273 (Lock stable_crate_ids once in create_crate_num)
 - #155361 (Document that CFI diverges from Rust wrt. ABI-compatibility rules)
 - #155692 (disable naked-dead-code-elimination test if no RET mnemonic is available)
 - #155747 (Update documentation for `wasm32-wali-linux-musl` after integrating n…)
 - #155768 (compiletest: Overhaul the code for running an incremental test revision)
 - #155907 (Handle hkl const closures)
 - #155910 (misc stuff from reading borrowck again :))
 - #155913 (Delete the 12 year old fixme)
 - #155920 (remove review queue triagebot mentions)
rust-bors Bot pushed a commit that referenced this pull request Apr 28, 2026
…uwer

Rollup of 14 pull requests

Successful merges:

 - #155850 (Only exclude the #155473 change for 1-byte bool-likes)
 - #155923 (Subtree sync for rustc_codegen_cranelift)
 - #151994 (switch to v0 mangling by default on stable)
 - #154325 (Tweak irrefutable let else warning output)
 - #155899 (`dlltool`: Set the working directory to workaround `--temp-prefix` bug)
 - #155273 (Lock stable_crate_ids once in create_crate_num)
 - #155361 (Document that CFI diverges from Rust wrt. ABI-compatibility rules)
 - #155692 (disable naked-dead-code-elimination test if no RET mnemonic is available)
 - #155747 (Update documentation for `wasm32-wali-linux-musl` after integrating n…)
 - #155768 (compiletest: Overhaul the code for running an incremental test revision)
 - #155907 (Handle hkl const closures)
 - #155910 (misc stuff from reading borrowck again :))
 - #155913 (Delete the 12 year old fixme)
 - #155920 (remove review queue triagebot mentions)
rust-bors Bot pushed a commit that referenced this pull request Apr 28, 2026
…uwer

Rollup of 15 pull requests

Successful merges:

 - #155923 (Subtree sync for rustc_codegen_cranelift)
 - #155930 (Sync from portable simd 2026 04 28)
 - #155850 (Only exclude the #155473 change for 1-byte bool-likes)
 - #151994 (switch to v0 mangling by default on stable)
 - #154325 (Tweak irrefutable let else warning output)
 - #155273 (Lock stable_crate_ids once in create_crate_num)
 - #155361 (Document that CFI diverges from Rust wrt. ABI-compatibility rules)
 - #155692 (disable naked-dead-code-elimination test if no RET mnemonic is available)
 - #155747 (Update documentation for `wasm32-wali-linux-musl` after integrating n…)
 - #155768 (compiletest: Overhaul the code for running an incremental test revision)
 - #155907 (Handle hkl const closures)
 - #155910 (misc stuff from reading borrowck again :))
 - #155913 (Delete the 12 year old fixme)
 - #155920 (remove review queue triagebot mentions)
 - #155936 (Rename `SharedContext::emit_dyn_lint*` into `emit_lint*`)
rust-bors Bot pushed a commit that referenced this pull request Apr 28, 2026
…uwer

Rollup of 15 pull requests

Successful merges:

 - #155923 (Subtree sync for rustc_codegen_cranelift)
 - #155930 (Sync from portable simd 2026 04 28)
 - #155850 (Only exclude the #155473 change for 1-byte bool-likes)
 - #151994 (switch to v0 mangling by default on stable)
 - #154325 (Tweak irrefutable let else warning output)
 - #155273 (Lock stable_crate_ids once in create_crate_num)
 - #155361 (Document that CFI diverges from Rust wrt. ABI-compatibility rules)
 - #155692 (disable naked-dead-code-elimination test if no RET mnemonic is available)
 - #155747 (Update documentation for `wasm32-wali-linux-musl` after integrating n…)
 - #155768 (compiletest: Overhaul the code for running an incremental test revision)
 - #155907 (Handle hkl const closures)
 - #155910 (misc stuff from reading borrowck again :))
 - #155913 (Delete the 12 year old fixme)
 - #155920 (remove review queue triagebot mentions)
 - #155936 (Rename `SharedContext::emit_dyn_lint*` into `emit_lint*`)
@rust-bors rust-bors Bot merged commit 8ee7836 into rust-lang:main Apr 28, 2026
11 checks passed
@rustbot rustbot added this to the 1.97.0 milestone Apr 28, 2026
rust-timer added a commit that referenced this pull request Apr 28, 2026
Rollup merge of #154325 - WeiTheShinobi:tweak-let-else-output, r=davidtwco

Tweak irrefutable let else warning output

Fixes #153454

Greeting!
This PR tweak diagnostic output for `irrefutable-let-else` patterns and adds a check for `let a = Some(b) else {...}`
Thanks for the review!

```
help: consider using `let Some(name) = case` to match on a specific variant
   |
LL -     let name = Some(case) else {
LL +     let Some(name) = case else {
   |
```
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.

Tweak irrefutable let else warning output

4 participants