Create promoted MIR fragments for const and statics#66642
Create promoted MIR fragments for const and statics#66642bors merged 2 commits intorust-lang:masterfrom
const and statics#66642Conversation
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
DropandStorageDeadfor promoted locals only worked for rvalue lifetime extension and only if noloops were present. This PR applies the approach currently used forfnandconst fns toconstandstatics.This may have some performance impacts.
r? @eddyb