-
Notifications
You must be signed in to change notification settings - Fork 13.5k
emit StorageLive
and schedule StorageDead
for let
-else
's bindings after matching
#143028
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
base: master
Are you sure you want to change the base?
Conversation
Some changes occurred in match lowering cc @Nadrieril |
Building for crater: |
emit `StorageLive` and schedule `StorageDead` for `let`-`else`'s bindings after matching This PR removes special handling of `let`-`else`, so that `StorageLive`s are emitted and `StorageDead`s are scheduled only after pattern-matching has succeeded. This means `StorageDead`s will no longer appear for all of its bindings on the `else` branch (because they're not live yet) and its drops&`StorageDead`s will happen together like they do elsewhere, rather than having all drops first, then all `StorageDead`s. This fixes #142056, and is therefore a breaking change. I believe it'll need a crater run and a T-lang nomination/fcp thereafter. Specifically, this makes drop-checking slightly more restrictive for `let`-`else` to match the behavior of other variable binding forms. An alternative approach could be to change the relative order of drops and `StorageDead`s for other binding forms to make drop-checking more permissive, but making that consistent would be a significantly more involved change. r? mir cc `@dingxiangfei2009` `@rustbot` label +T-lang +needs-crater
@craterbot check |
👌 Experiment ℹ️ Crater is a tool to run experiments across parts of the Rust ecosystem. Learn more |
🚧 Experiment ℹ️ Crater is a tool to run experiments across parts of the Rust ecosystem. Learn more |
🎉 Experiment
|
Since crater finished it's experiment, how's overall results? I've opened a link with a full report but it seems more complicated |
The regressed and fixed crates look wholly unrelated to this PR. I'm not too surprised, since this is a very niche breakage. It doesn't look like there will be any ecosystem impact if this is merged. There's a few failures to download/access dependencies, what looks like an failure in a perl build script1, and a couple docker errors. I'm not too knowledgeable about crater's infrastructure so I couldn't say why any of it is happening or whether those crates should be put on the denylist, but none of that sounds like the fault of Footnotes
|
@est31, I believe you should be interested in this changes, also if you are familiar with the mir building part could you please review this? |
To be clear, the potential breakage from this PR should only be to I intend to open some PRs for drop order changes as well, including for |
This is done in the name of consistency, right? Naively, I'd tend towards making things more permissible rather than more restrictive, and change the existing constructs instead. But probably this way, the rules are easier to describe, and it is less surprising that this code stops compiling the moment becomes non-Copy. I suppose a crater run in the other run wouldn't bring up any breakages either because it'd strictly make more things compile, rather than less? Otherwise I'd have suggested doing it, but I suppose it's not going to bring up any results either.
Actually not that familiar with it, but I can still take a look. I see @dingxiangfei2009 is already in the zulip thread, he is definitely quite familiar with it.
Yeah it's a bit noisy, or at least was a while ago when I was looking at results. It's entirely possible that it shows only noise. That's a good sign, meaning that it really has low impact. |
I'd prefer to make it more permissive too, but the inconsistencies are indeed tougher to iron out in that direction. Though maybe it's not an issue? The big inconsistency I can think of is that without sorting the
If that's not an issue, I could see about opening an alternative PR implementing that relaxed behavior instead. Having all the
I don't think it'd be too much harder to describe if the drops and edit: actually, doing all drops before |
This PR removes special handling of
let
-else
, so thatStorageLive
s are emitted andStorageDead
s are scheduled only after pattern-matching has succeeded. This meansStorageDead
s will no longer appear for all of its bindings on theelse
branch (because they're not live yet) and its drops&StorageDead
s will happen together like they do elsewhere, rather than having all drops first, then allStorageDead
s.This fixes #142056, and is therefore a breaking change. I believe it'll need a crater run and a T-lang nomination/fcp thereafter. Specifically, this makes drop-checking slightly more restrictive for
let
-else
to match the behavior of other variable binding forms. An alternative approach could be to change the relative order of drops andStorageDead
s for other binding forms to make drop-checking more permissive, but making that consistent would be a significantly more involved change.r? mir
cc @dingxiangfei2009
@rustbot label +T-lang +needs-crater