-
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
tests encoding current behavior for various cases of "binding" to _. #69573
Conversation
(rust_highfive has picked a reviewer for you, use r? to override) |
let (_, _) = mm; | ||
} | ||
|
||
fn match_moved_expr_to_wild() { |
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.
General note: Would be good to also test if let
as it might diverge somewhat in the future in terms of MIR building.
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.
hmm. interesting the most obvious "ports" of these tests as written into if let
form runs afoul of "warning: irrefutable if-let pattern"
Which makes total sense.
But also leads me to wonder whether I should be testing them in different fashion. I'm not sure these tests translate over to refutable patterns, because if the data has been moved away, then you won't have a discriminant to inspect.
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.
Perhaps just inserting an Option<_>
layer would be good for the match/if-let tests? iirc I did that in a somewhat similar test somewhere. Presumably _
should work below sum types as well.
r? @Centril r=me with comments ^-- addressed. |
The job Click to expand the log.
I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact |
whoops! (wasn't able to test locally because I had to task switch to resolving a beta regression. I'll fix the tests.) |
@pnkfelix any updates? |
The `_` binding form is special, in that it encodes a "no-op": nothing is actually bound, and thus nothing is moved or borrowed in this scenario. Usually we do the "right" thing in all such cases. The exceptions are explicitly pointed out in this test case, so that we keep track of whether they are eventually fixed.
Co-Authored-By: Mazdak Farrokhzad <twingoow@gmail.com>
Co-Authored-By: Mazdak Farrokhzad <twingoow@gmail.com>
327a869
to
22ea3a4
Compare
Decided to @bors r+ |
📌 Commit 22ea3a4 has been approved by |
…entril tests encoding current behavior for various cases of "binding" to _. The `_` binding form is special, in that it encodes a "no-op": nothing is actually bound, and thus nothing is moved or borrowed in this scenario. Usually we do the "right" thing in all such cases. The exceptions are explicitly pointed out in this test case, so that we keep track of whether they are eventually fixed. Cc rust-lang#53114. (This does not close the aforementioned issue; it just adds the tests encoding the current behavior, which we hope to eventually fix.)
…entril tests encoding current behavior for various cases of "binding" to _. The `_` binding form is special, in that it encodes a "no-op": nothing is actually bound, and thus nothing is moved or borrowed in this scenario. Usually we do the "right" thing in all such cases. The exceptions are explicitly pointed out in this test case, so that we keep track of whether they are eventually fixed. Cc rust-lang#53114. (This does not close the aforementioned issue; it just adds the tests encoding the current behavior, which we hope to eventually fix.)
☀️ Test successful - checks-azure |
Rollup of 5 pull requests Successful merges: - rust-lang#69573 (tests encoding current behavior for various cases of "binding" to _.) - rust-lang#70881 (bootstrap: work around "unused attribute" errors in incremental stdlib rebuilds.) - rust-lang#70957 (Normalize MIR locals' types for generator layout computation.) - rust-lang#70962 (added machine hooks to track deallocations) - rust-lang#70982 (Normalize function signature in function casting check procedure) Failed merges: r? @ghost
The
_
binding form is special, in that it encodes a "no-op": nothing is actually bound, and thus nothing is moved or borrowed in this scenario. Usually we do the "right" thing in all such cases. The exceptions are explicitly pointed out in this test case, so that we keep track of whether they are eventually fixed.Cc #53114.
(This does not close the aforementioned issue; it just adds the tests encoding the current behavior, which we hope to eventually fix.)