Skip to content

Tweak suggestion of "unreachable due to never pattern" - #163764

Merged
rust-bors[bot] merged 1 commit into
rust-lang:mainfrom
estebank:never-pattern-suggestion
Nov 2, 2026
Merged

rust-bors[bot] merged 1 commit into
rust-lang:mainfrom
estebank:never-pattern-suggestion

Conversation

@estebank

@estebank estebank commented Oct 4, 2026

Copy link
Copy Markdown
Contributor

Use more accurate span when suggesting to remove guard and body of a never-pattern match arm (feature(never_patterns)].

error: a guard on a never pattern will never be run
  --> $DIR/ICE-119271-never-arm-attr-in-guard.rs:8:13
   |
LL |             false
   |             ^^^^^
   |
help: remove the guard, leaving only the pattern
   |
LL -         Some(!)
LL -
LL -             if #[deny(unused_mut)]
LL -             false
LL +         Some(!)
   |

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

rustbot commented Oct 4, 2026

Copy link
Copy Markdown
Collaborator

r? @dingxiangfei2009

rustbot has assigned @dingxiangfei2009.
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 77 candidates
  • Random selection from 18 candidates

@fmease fmease 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.

Thanks! I'll approve since it fixes the suggestion but note that bodiless arms won't stay around: #153134 (comment).

@bors r+ rollup

View changes since this review

@rust-bors

rust-bors Bot commented Nov 1, 2026

Copy link
Copy Markdown
Contributor

📌 Commit ca3c628 has been approved by fmease

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 Nov 1, 2026
@fmease fmease assigned fmease and unassigned dingxiangfei2009 Nov 1, 2026
jhpratt added a commit to jhpratt/rust that referenced this pull request Nov 2, 2026
… r=fmease

Tweak suggestion of "unreachable due to never pattern"

Use more accurate span when suggesting to remove guard and body of a never-pattern match arm (`feature(never_patterns)`].

```
error: a guard on a never pattern will never be run
  --> $DIR/ICE-119271-never-arm-attr-in-guard.rs:8:13
   |
LL |             false
   |             ^^^^^
   |
help: remove the guard, leaving only the pattern
   |
LL -         Some(!)
LL -
LL -             if #[deny(unused_mut)]
LL -             false
LL +         Some(!)
   |
```
@jhpratt

jhpratt commented Nov 2, 2026

Copy link
Copy Markdown
Member

@bors r- #165312 (comment)

    Checking rustc_public_bridge v0.0.0 (/checkout/compiler/rustc_public_bridge)
error[E0599]: no method named `eq_ctxt` found for struct `rustc_span::Span` in the current scope
   --> compiler/rustc_ast_lowering/src/expr.rs:820:43
    |
820 |             let remove_span = if arm.span.eq_ctxt(arm.pat.span) {
    |                                           ^^^^^^^
    |
help: there is a method `ctxt` with a similar name, but with different arguments
   --> compiler/rustc_span/src/span_encoding.rs:516:5
    |

@rust-bors rust-bors Bot 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-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Nov 2, 2026
@rust-bors

rust-bors Bot commented Nov 2, 2026

Copy link
Copy Markdown
Contributor

This pull request was unapproved.

This PR was contained in a rollup (#165312), which was unapproved.

View changes since this unapproval

@estebank
estebank force-pushed the never-pattern-suggestion branch from ca3c628 to 6ea5072 Compare November 2, 2026 04:51
@rustbot

rustbot commented Nov 2, 2026

Copy link
Copy Markdown
Collaborator

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.

Use more accurate span when suggesting to remove guard and body of a never-pattern match arm (`feature(never_patterns)`].

```
error: a guard on a never pattern will never be run
  --> $DIR/ICE-119271-never-arm-attr-in-guard.rs:8:13
   |
LL |             false
   |             ^^^^^
   |
help: remove the guard, leaving only the pattern
   |
LL -         Some(!)
LL -
LL -             if #[deny(unused_mut)]
LL -             false
LL +         Some(!)
   |
```
@estebank
estebank force-pushed the never-pattern-suggestion branch from 6ea5072 to 4b9c00c Compare November 2, 2026 04:51
@estebank

estebank commented Nov 2, 2026

Copy link
Copy Markdown
Contributor Author

@bors r=fmease

@rust-bors

rust-bors Bot commented Nov 2, 2026

Copy link
Copy Markdown
Contributor

📌 Commit 4b9c00c has been approved by fmease

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-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Nov 2, 2026
rust-bors Bot pushed a commit that referenced this pull request Nov 2, 2026
…uwer

Rollup of 6 pull requests

Successful merges:

 - #163764 (Tweak suggestion of "unreachable due to never pattern")
 - #164771 (std: fix platform checks for hermit)
 - #165070 (create mir for direct-rhs consts)
 - #165121 (test DSL evaluate sequentially)
 - #165288 (Add assembly test for masked index without redundant shifts)
 - #165307 (test(lexer): Add test that ZWJ/ZWNJ are accepted in identifiers)
rust-bors Bot pushed a commit that referenced this pull request Nov 2, 2026
Rollup merge of #163764 - estebank:never-pattern-suggestion, r=fmease

Tweak suggestion of "unreachable due to never pattern"

Use more accurate span when suggesting to remove guard and body of a never-pattern match arm (`feature(never_patterns)`].

```
error: a guard on a never pattern will never be run
  --> $DIR/ICE-119271-never-arm-attr-in-guard.rs:8:13
   |
LL |             false
   |             ^^^^^
   |
help: remove the guard, leaving only the pattern
   |
LL -         Some(!)
LL -
LL -             if #[deny(unused_mut)]
LL -             false
LL +         Some(!)
   |
```
@rust-bors
rust-bors Bot merged commit 9b4c176 into rust-lang:main Nov 2, 2026
14 checks passed
@rustbot rustbot added this to the 1.101.0 milestone Nov 2, 2026
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.

5 participants