-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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
NLL Regression: Conditional control flow returning from functions no longer works #51545
Comments
More generally, this means that Problem Case 3 from the NLL RFC no longer works. https://play.rust-lang.org/?gist=49970ae2c8f31d747f3dbbee90975c70&version=nightly&mode=debug |
Oh, is this what we were talking about? Yes, this is intentional. Check out Niko's blog post:
|
This looks like a duplicate of #21906. |
If a match expression has one arm that returns a borrowed matched value from its pattern, and another arm that doesn't borrow directly from a matched value but instead borrows the variable the matched value borrows and returns it, compilation fails if the match statement is returning from a function, but not if it's assigning to a variable. This used to work (and iirc one of the goals of NLLs was to make this pattern work), but it broke between
nightly-2018-05-17
andnightly-2018-05-19
. A nightly for May 18th doesn't appear to exist.Examples:
This doesn't work now:
This is similar to the other code, but does work both before and after
nightly-2018-05-19
The text was updated successfully, but these errors were encountered: