Skip to content

Conversation

@kavon
Copy link
Member

@kavon kavon commented May 2, 2023

β€’ Description: Allows people to write ~Copyable in the inheritance clause of an enum or struct to annotate that type as noncopyable. The approach in this PR is to internally annotate the type with @_moveOnly, so it side-steps any changes to the type system in favor of already-well-tested code paths that look for the attribuet.
β€’ Risk: Low. A ~ appearing in the clause would never have parsed correctly before. Copyable is not even a valid type.
β€’ Original PR: #65556
β€’ Reviewed By: Joe Groff
β€’ Testing: regression tests included
β€’ Resolves: rdar://106775103

Depends on companion PR for swift-syntax in 5.9: swiftlang/swift-syntax#1560

We parse `~Copyable` in an inheritance clause of enum and
struct decls as a synonym for the `@_moveOnly` attribute
being added to that decl. This completely side-steps the
additional infrastructure for generalized suppressed
conformances in favor of a minimal solution. One benefit of
this minimal solution is that it doesn't risk introducing
any back-compat issues with older compilers or stdlibs.

The trade-off is that we're more committed to supporting
`@_moveOnly` in compiled modules in the future. In fact,
this change does not deprecate `@_moveOnly` in any way.

resolves rdar://106775103
@kavon kavon requested a review from a team as a code owner May 2, 2023 19:19
@kavon kavon changed the title Build support for ~Copyable atop @_moveOnly [5.9 πŸ’] Build support for ~Copyable atop @_moveOnly May 2, 2023
@kavon
Copy link
Member Author

kavon commented May 2, 2023

swiftlang/swift-syntax#1560
@swift-ci please test

@kavon kavon merged commit 6453128 into swiftlang:release/5.9 May 3, 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