-
Notifications
You must be signed in to change notification settings - Fork 13k
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
mir_build: Use let-chains in prefix_slice_suffix
, and note an edge case
#135756
Conversation
r? @wesleywiser rustbot has assigned @wesleywiser. Use |
47b498f
to
5bf1de1
Compare
This comment has been minimized.
This comment has been minimized.
5bf1de1
to
be347c9
Compare
Appeased tidy by renaming the test file (diff). |
A few more notes on “not well represented in our test suite”: If I add an extra argument to
That test is somewhat related to this edge case (an array place that doesn't need to be captured), but in a way that wasn't very obvious to me when I first noticed that my assertion was being violated. There are also several other tests in |
I also renamed |
Alternate idea: What if I just make the caller directly responsible for determining what the min-length or exact-length is? @rustbot author |
Rename test to `unresolvable-upvar-issue-87987.rs` and add some notes Extracted from rust-lang#135756. I had to figure out what this test was trying to test, so I might as well write it down for future reference.
Rename test to `unresolvable-upvar-issue-87987.rs` and add some notes Extracted from rust-lang#135756. I had to figure out what this test was trying to test, so I might as well write it down for future reference.
Rollup merge of rust-lang#135985 - Zalathar:whats-upvar, r=lqd Rename test to `unresolvable-upvar-issue-87987.rs` and add some notes Extracted from rust-lang#135756. I had to figure out what this test was trying to test, so I might as well write it down for future reference.
☔ The latest upstream changes (presumably #136041) made this pull request unmergeable. Please resolve the merge conflicts. |
This got a bit out of hand, and I’m also not that invested in it, so I’m just going to close. |
I noticed that the original code has two identical fallback paths that can be combined into one by using a let-chain for the success case.
While investigating this code, I tried to check my understanding by adding an assertion that
exact_size
is true iff we are dealing with an array pattern (and not a slice pattern). That uncovered a non-obvious edge case that is not well represented in our test suite, so I added a mir-opt test that explicitly triggers that edge case, to catch any future changes that assume it can't happen.