-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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 feature to enable bind by move pattern guards #54034
Add feature to enable bind by move pattern guards #54034
Conversation
r? @varkor (rust_highfive has picked a reviewer for you, use r? to override) |
@@ -0,0 +1,9 @@ | |||
error[E0008]: cannot bind by-move into a pattern guard |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, I guess it would be nice (when on nightly and with MIR-borrowck enabled) if this issued a diagnostic suggesting the feature gate.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(done, see commit c329897)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could also be useful to suggest enabling NLL and the feature if not? Perhaps that's a little convoluted though.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think that's necessary; the 2018 edition has NLL enabled anyway (under migrate mode), so I think that will be enough.
☔ The latest upstream changes (presumably #54093) made this pull request unmergeable. Please resolve the merge conflicts. |
src/test/ui/rfc-0107-bind-by-move-pattern-guards/bind-by-move-no-guards.rs
Outdated
Show resolved
Hide resolved
src/test/ui/rfc-0107-bind-by-move-pattern-guards/feature-gate.rs
Outdated
Show resolved
Hide resolved
src/test/ui/rfc-0107-bind-by-move-pattern-guards/rfc-basic-examples.rs
Outdated
Show resolved
Hide resolved
src/test/ui/rfc-0107-bind-by-move-pattern-guards/rfc-reject-double-move-across-arms.rs
Outdated
Show resolved
Hide resolved
src/test/ui/rfc-0107-bind-by-move-pattern-guards/rfc-reject-double-move-in-first-arm.rs
Outdated
Show resolved
Hide resolved
The implementation looks good to me, but I'd feel more comfortable if someone more familiar with borrowck double-checked. |
c329897
to
1bdc926
Compare
This comment has been minimized.
This comment has been minimized.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
r=me
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
1bdc926
to
e801def
Compare
This comment has been minimized.
This comment has been minimized.
e801def
to
40d8f54
Compare
Note it requires MIR-borrowck to be enabled to actually do anything. Note also that it implicitly turns off our AST-based check for mutation in guards.
Apparently copyright notices are no longer necessary apparently. (See rust-lang#43498 and rust-lang#53654.)
…]` when it might fix the code.
40d8f54
to
3a07d3d
Compare
@bors r=nikomatsakis |
📌 Commit 3a07d3d has been approved by |
…ds, r=nikomatsakis Add feature to enable bind by move pattern guards Implement #15287 as described on #15287 (comment)
☀️ Test successful - status-appveyor, status-travis |
Implement #15287 as described on #15287 (comment)