-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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
Create promoted MIR fragments for const
and static
s
#66642
Conversation
The previous test was incorrect. `const fn`s are *always* promotable when inside a `const`, so it should pass. The error was caused by a bug in `promote_consts`. I've added a failing test outside a `const` alongside the existing one, which is now run-pass.
The previous strategy of removing `Drop` and `StorageDead` for promoted locals only worked for rvalue lifetime extension. We now use the same implementation for promotion across all kinds of items.
r=me after running perf |
@bors try |
Awaiting bors try build completion |
⌛ Trying commit f9ed219 with merge c17aff946ccec0822adaa7cc9c00a9e35e685a5e... |
☀️ Try build successful - checks-azure |
Queued c17aff946ccec0822adaa7cc9c00a9e35e685a5e with parent 04e69e4, future comparison URL. |
Finished benchmarking try commit c17aff946ccec0822adaa7cc9c00a9e35e685a5e, comparison URL. |
This appears to actually be faster for @bors r=eddyb |
📌 Commit f9ed219 has been approved by |
This comment has been minimized.
This comment has been minimized.
📌 Commit f9ed219 has been approved by |
Create promoted MIR fragments for `const` and `static`s Resolves #65732. The previous strategy of removing `Drop` and `StorageDead` for promoted locals only worked for rvalue lifetime extension and only if no `loop`s were present. This PR applies the approach currently used for `fn` and `const fn`s to `const` and `statics`. This may have some performance impacts. r? @eddyb
I think it's more likely due to are borrowck (mostly) ignoring promoteds. |
☀️ Test successful - checks-azure |
Resolves #65732.
The previous strategy of removing
Drop
andStorageDead
for promoted locals only worked for rvalue lifetime extension and only if noloop
s were present. This PR applies the approach currently used forfn
andconst fn
s toconst
andstatics
.This may have some performance impacts.
r? @eddyb