`enable-library-evolution` breaks NonCopyable types

"-enable-library-evolution" breaks compilation of _@moveOnly types, is that intentional? resulting in error message: Usage of a move only type that the move checker does not know how to check!

If I remove "-enable-library-evolution" it works however.


There are known issues with noncopyable types and library evolution, yeah. Declaring your public noncopyable types as @frozen should work around them. If you want to reserve some ability to evolve your noncopyable types without breaking ABI, you should be able to use a non-@frozen, @usableFromInline copyable type to hold the noncopyable type's storage, as in:

@usableFromInline
struct _FooImpl { ... }

@frozen
public struct Foo: ~Copyable { var impl: _FooImpl }
7 Likes