Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[needless_return_with_question_mark]: don't lint if never type is used for coercion #11627

Merged
merged 1 commit into from
Nov 22, 2023

Conversation

y21
Copy link
Member

@y21 y21 commented Oct 6, 2023

Fixes #11616

When we have something like

let _x: String = {
  return Err(())?;
};

we shouldn't suggest removing the return because the !-ness of return is used to coerce the enclosing block to some other type. That will lead to a typeck error without a diverging expression like return.

changelog: [needless_return_with_question_mark]: don't lint if returns never typed-ness is used for coercion

@rustbot
Copy link
Collaborator

rustbot commented Oct 6, 2023

r? @giraffate

(rustbot has picked a reviewer for you, use r? to override)

@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties label Oct 6, 2023
@bors
Copy link
Collaborator

bors commented Nov 15, 2023

☔ The latest upstream changes (presumably #11802) made this pull request unmergeable. Please resolve the merge conflicts.

Copy link
Contributor

@giraffate giraffate left a comment

Choose a reason for hiding this comment

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

Sorry for the late reviewing. Can you resolve the conflicts?

@giraffate
Copy link
Contributor

@bors r+

Thanks!

@bors
Copy link
Collaborator

bors commented Nov 22, 2023

📌 Commit a74fa97 has been approved by giraffate

It is now in the queue for this repository.

@bors
Copy link
Collaborator

bors commented Nov 22, 2023

⌛ Testing commit a74fa97 with merge a8b0e5f...

@bors
Copy link
Collaborator

bors commented Nov 22, 2023

☀️ Test successful - checks-action_dev_test, checks-action_remark_test, checks-action_test
Approved by: giraffate
Pushing a8b0e5f to master...

@bors bors merged commit a8b0e5f into rust-lang:master Nov 22, 2023
5 checks passed
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
Projects
None yet
Development

Successfully merging this pull request may close these issues.

needless_return_with_question_mark lints when never type is used for coercion
4 participants