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

Add support for while let #17733

Merged
merged 7 commits into from
Oct 13, 2014
Merged

Add support for while let #17733

merged 7 commits into from
Oct 13, 2014

Conversation

jgallagher
Copy link

This is heavily based on if let (#17634) by @jakub- and @kballard

This should close #17687

@ftxqxd
Copy link
Contributor

ftxqxd commented Oct 3, 2014

I suspect that this isn’t supposed to be so heavily based on if let that the title is the same…

@jgallagher jgallagher changed the title Add support for if let Add support for while let Oct 3, 2014
@jgallagher
Copy link
Author

Hah, oi. headdesk

@lilyball
Copy link
Contributor

lilyball commented Oct 3, 2014

Subject line needs fixing.

}
} else {
span_err!(cx.tcx.sess, pat.span, E0001, "unreachable pattern");
span_err!(cx.tcx.sess, span, E0163, "irrefutable while-let pattern");
Copy link
Contributor

Choose a reason for hiding this comment

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

Is there a specific reason this is an error? What if I want to do an infinite loop with destructuring?

Copy link
Author

Choose a reason for hiding this comment

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

@jgallagher
Copy link
Author

Rebased onto current master

@brson
Copy link
Contributor

brson commented Oct 10, 2014

cc @pnkfelix @nrc @pcwalton

span_err!(cx.tcx.sess, span, E0165, "irrefutable while-let pattern");
},

_ => span_err!(cx.tcx.sess, pat.span, E0001, "unreachable pattern")
Copy link

Choose a reason for hiding this comment

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

nit: Could you please make this a specific pattern, i.e.:

    MatchNormal => span_err!(cx.tcx.sess, pat.span, E0001, "unreachable pattern")

The set of variants of this particular enum probably won't grow in the near future but it's still good for clarity, I think.

Copy link
Author

Choose a reason for hiding this comment

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

Thanks, fixed in 16ccdba.

bors added a commit that referenced this pull request Oct 13, 2014
This is *heavily* based on `if let` (#17634) by @jakub- and @kballard

This should close #17687
@bors bors closed this Oct 13, 2014
@bors bors merged commit 16ccdba into rust-lang:master Oct 13, 2014
@jgallagher jgallagher deleted the while-let branch October 14, 2014 18:43
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.

Tracking issue for while let
8 participants