rust
rust copied to clipboard
Avoid duplicating StorageLive in let-else
cc @est31
Fix #101867 Fix #101932
#101410 introduced directives to activate storages of bindings in let-else earlier. However, since it is using the machinery of match
and friends for pattern matching and binding, those storages are activated for the second time. This PR adjusts this behavior and avoid the duplicated activation for let-else statements.
r? @oli-obk
(rust-highfive has picked a reviewer for you, use r? to override)
./x.py test src/tools/miri
is now passing again after this change. You may try it out.
Please also add a mir-opt test. https://github.com/rust-lang/rust/pull/101410#issuecomment-1248806073 seems like a good candidate as it is very minimal.
Preemptively beta-nominating for backport to 1.65 (into which https://github.com/rust-lang/rust/pull/101410 landed), since it seems likely this would otherwise only make 1.66. (If we reject this we'll likely want to post a revert for #101410, but this was an easier first step to track the need).
@oli-obk Thank you! I have added that test mentioned in the #101410 thread. I have tentatively selected mir_map
which is hopefully very close to the original MIR generated. Please advise better choices. :pray:
@dingxiangfei2009 now that #93628 has been merged, can you rebase this PR? Most importantly, the test files will need #![cfg_attr(bootstrap, feature(let_else))]
, instead of #![feature(let_else)]
.
Also, would it be possible to add the example from #101932 as a run-pass regression test? So add // run-pass
to it as well as // issue #101932
, and put it e.g. into src/test/ui/let-else/const-fn.rs
.
@est31 branch rebased with the test case from #101932
cc @oli-obk for the relevant changes.
This issue is completely blocking Miri development, would be good to get the fix landed ASAP. :)
@bors r+ p=1 (unblocks miri)
:pushpin: Commit eb36f5ee5b71cbe3eb356f8e56e9c9a69b6d649d has been approved by oli-obk
It is now in the queue for this repository.
@bors p=10
:hourglass: Testing commit eb36f5ee5b71cbe3eb356f8e56e9c9a69b6d649d with merge 2019147c5642c08cdb9ad4cacd97dd1fa4ffa701...
:sunny: Test successful - checks-actions Approved by: oli-obk Pushing 2019147c5642c08cdb9ad4cacd97dd1fa4ffa701 to master...
Finished benchmarking commit (2019147c5642c08cdb9ad4cacd97dd1fa4ffa701): comparison URL.
Overall result: no relevant changes - no action needed
@rustbot label: -perf-regression
Instruction count
This benchmark run did not return any relevant results for this metric.
Max RSS (memory usage)
Results
This is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.
mean[^1] | range | count[^2] | |
---|---|---|---|
Regressions ❌ (primary) |
- | - | 0 |
Regressions ❌ (secondary) |
2.6% | [2.2%, 3.3%] | 3 |
Improvements ✅ (primary) |
- | - | 0 |
Improvements ✅ (secondary) |
- | - | 0 |
All ❌✅ (primary) | - | - | 0 |
Cycles
This benchmark run did not return any relevant results for this metric.
[^1]: the arithmetic mean of the percent change [^2]: number of relevant changes
Judging from this the release team will do the beta backports so I consider this done from my end now. :)