Skip to content

Conversation

@estebank
Copy link
Contributor

@estebank estebank commented Dec 12, 2025

When encountering an if expression with no else where the then block has a tail expression, we emit an E0308 type error. We now explain why () was expected.

Partially address #144911.

… no `else`

When encountering an `if` expression with no `else` where the then
block has a tail expression, we emit an E0308 type error. We now explain
why `()` was expected.
@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Dec 12, 2025
@rustbot rustbot added the T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. label Dec 12, 2025
@rustbot
Copy link
Collaborator

rustbot commented Dec 12, 2025

r? @fee1-dead

rustbot has assigned @fee1-dead.
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

LL | |
LL | | }
| |_________- expected this to be `()`
| |_________- expected this `if` expression to be `()` because it has no `else` arm
Copy link
Member

Choose a reason for hiding this comment

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

Aren't we pointing at the block? It seems slightly off to call it an if expression, although I don't have a good alternative in mind right now.

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.

3 participants