Copy trait defeats generator optimization #62952
Labels
A-coroutines
Area: Coroutines
C-enhancement
Category: An issue proposing an enhancement or a PR with one.
C-optimization
Category: An issue highlighting optimization opportunities or PRs implementing such
I-heavy
Issue: Problems and improvements with respect to binary size of generated code.
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
The following example (playground):
Outputs:
The only difference between Foo and Bar is that Foo is Copy. This defeats the generator optimization implemented in #61922 which considers any local that has been moved from as a candidate for overlap.
Technically, this is semantically consistent with the existing overlap behavior for generators. But making a type
Copy
and getting worse performance is a footgun that we should fix.This can be fixed with a pass that turns unnecessary copies into moves in MIR.
The text was updated successfully, but these errors were encountered: