Skip to content
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

Remove need for Copy on error enums #1292

Merged
merged 12 commits into from
Sep 27, 2024
Merged

Remove need for Copy on error enums #1292

merged 12 commits into from
Sep 27, 2024

Conversation

leighmcculloch
Copy link
Member

@leighmcculloch leighmcculloch commented Jul 11, 2024

What

Remove need for Copy/Clone/etc on error enums and int enums.

Why

Less compiler errors for folks just getting started.

The generated code currently requires that error enums impl the Copy trait because they use a copy within. That copy is unnecessary and this change removes it, removing the need for Copy to be derived on error enums.

I was confident that the copy had been put there as an optimisation, but when I looked into the code that was relying on it I found not optimisation was in use. When I tried to add the optimisation, I couldn't find a contract size difference.

A while ago we in #1293 added better error messages for needing copy, which was a good fix at the time, I just think we can remove the need for this all together.

Close #630

@leighmcculloch leighmcculloch changed the title Remove need for Copy/Clone/etc on error enums Remove need for Copy on error enums Jul 11, 2024
@leighmcculloch leighmcculloch marked this pull request as ready for review July 11, 2024 05:22
@leighmcculloch leighmcculloch deleted the i630 branch July 11, 2024 06:26
@leighmcculloch leighmcculloch added this pull request to the merge queue Sep 27, 2024
Merged via the queue into main with commit 627e164 Sep 27, 2024
16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add a clear error message for when an integer enum doesn't have derive(Copy)
2 participants