Skip to content

[5.9] [move-only] Temporarily ban deinits on non-copyable enums. #64919

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

Merged
merged 1 commit into from
Apr 5, 2023

Conversation

jckarter
Copy link
Contributor

@jckarter jckarter commented Apr 4, 2023

The reason why we are doing this is that:

  1. For non-copyable types, switches are always at +1 for now.
  2. non-copyable enums with deinits cannot be switched upon since that would invalidate the deinit.

So deinits on non-copyable enums are just not useful at this point since you cannot open the enum.

Once we make it so that you can bind a non-copyable enum at +0, we will remove this check.

I added an experimental feature MoveOnlyEnumDeinits so tests that validate the codegen/etc will still work.

rdar://101651138

The reason why we are doing this is that:

1. For non-copyable types, switches are always at +1 for now.
2. non-copyable enums with deinits cannot be switched upon since that would
invalidate the deinit.

So deinits on non-copyable enums are just not useful at this point since you
cannot open the enum.

Once we make it so that you can bind a non-copyable enum at +0, we will
remove this check.

I added an experimental feature MoveOnlyEnumDeinits so tests that validate the
codegen/etc will still work.

rdar://101651138
@jckarter jckarter requested a review from a team as a code owner April 4, 2023 19:50
@jckarter
Copy link
Contributor Author

jckarter commented Apr 4, 2023

@swift-ci Please test

@jckarter
Copy link
Contributor Author

jckarter commented Apr 5, 2023

@swift-ci Please test Windows

@jckarter jckarter merged commit dd7552b into swiftlang:release/5.9 Apr 5, 2023
@AnthonyLatsis AnthonyLatsis added the 🍒 release cherry pick Flag: Release branch cherry picks label May 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🍒 release cherry pick Flag: Release branch cherry picks
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants