Skip to content

fix misleading diagnostics and improve diagnostics of return type mismatch - #162926

Open
Hamdan-Khan wants to merge 1 commit into
rust-lang:mainfrom
Hamdan-Khan:return-type-mismatch-diagnostics
Open

Hamdan-Khan wants to merge 1 commit into
rust-lang:mainfrom
Hamdan-Khan:return-type-mismatch-diagnostics

Conversation

@Hamdan-Khan

@Hamdan-Khan Hamdan-Khan commented Sep 17, 2026 •

Copy link
Copy Markdown
Contributor

Fix misleading diagnostics and improve diagnostics of return type mismatch

  • Fixed misleading suggestions of adding a return and semicolon expression to an expression already in return position by adding a return position check.

  • Fixed duplicate emission of error 277 by de-duplicateing the suggestion suggest_missing_break_or_return_expr, where a failed normalization leads to E277

fixes: #162271

@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 Sep 17, 2026
@rustbot

rustbot commented Sep 17, 2026

Copy link
Copy Markdown
Collaborator

r? @mati865

rustbot has assigned @mati865.
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 22 candidates

@mati865

mati865 commented Sep 17, 2026

Copy link
Copy Markdown
Member

@rustbot reroll

@rustbot rustbot assigned tiif and unassigned mati865 Sep 17, 2026
@tiif

tiif commented Sep 27, 2026

Copy link
Copy Markdown
Member

@rustbot reroll

@rustbot rustbot assigned TaKO8Ki and unassigned tiif Sep 27, 2026
@rust-bors

This comment has been minimized.

@rustbot

This comment has been minimized.

@rustbot

This comment has been minimized.

@rustbot rustbot added has-merge-commits PR has merge commits, merge with caution. S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Sep 28, 2026
…match

fixed misleading suggestions of adding a return and semicolon expression to an expression already in return position by adding a return position check.

fixed duplicate emission of error 277 by de-duplicateing the suggestion `suggest_missing_break_or_return_expr`, where a failed normalization leads to E277
@Hamdan-Khan
Hamdan-Khan force-pushed the return-type-mismatch-diagnostics branch from 706c0b2 to c608702 Compare September 30, 2026 17:29
@rustbot

rustbot commented Sep 30, 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.

@rustbot rustbot removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. has-merge-commits PR has merge commits, merge with caution. labels Sep 30, 2026
@Hamdan-Khan

Copy link
Copy Markdown
Contributor Author

Hey @TaKO8Ki , sorry for the ping. Mind taking a look at this when you're free?

This branch has not been deployed

No deployments
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.

Poor errors from type-mismatched early return when the return type is impl Future

5 participants