Skip to content

Print a friendly error for the if-let construct without an else block #20039

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

Merged
merged 2 commits into from
Dec 22, 2014

Conversation

barosl
Copy link
Contributor

@barosl barosl commented Dec 19, 2014

Fixes #19991.

@rust-highfive
Copy link
Contributor

r? @nick29581

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

@sfackler
Copy link
Member

Can you add a compile-fail test for the new error message?

),
_ => (
infer::MatchExpressionArm(expr.span, arm.body.span),
result_ty, // result_ty is "expected" here
Copy link
Member

Choose a reason for hiding this comment

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

I don't think you need this comment any more

Copy link
Contributor Author

Choose a reason for hiding this comment

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

You mean the "expected"-related ones? I will remove them.

@barosl barosl force-pushed the if-let-friendly-error branch 8 times, most recently from d2d88c5 to 5ed3ab0 Compare December 19, 2014 23:34
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.

Copy link
Member

Choose a reason for hiding this comment

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

Please add a comment saying what the test is testing.

@nrc
Copy link
Member

nrc commented Dec 19, 2014

Thanks for the fixes! Looks good, r=me with an extra comment in the test.

@barosl barosl force-pushed the if-let-friendly-error branch from 5ed3ab0 to 314ed2d Compare December 20, 2014 00:17
alexcrichton added a commit to alexcrichton/rust that referenced this pull request Dec 21, 2014
@bors bors merged commit 314ed2d into rust-lang:master Dec 22, 2014
lnicola pushed a commit to lnicola/rust that referenced this pull request Jun 23, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Error when if let arm doesn't return () could be more helpful
5 participants