-
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 |
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