Skip to content

Commit 8811170

Browse files
committed
[BitwiseCopyable] Inference for raw-value enums.
Clarified that it depends on the actual enum, not the `RawValue` type witness of the synthesized `RawRepresentable` conformance.
1 parent 9f63c40 commit 8811170

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

proposals/nnnn-bitwise-copyable.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,13 +141,15 @@ extension Box : BitwiseCopyable where Value : BitwiseCopyable {}
141141

142142
### Automatic inference for aggregates
143143

144-
As a convenience, unconditional conformances will be inferred for structs and enums much of the time.
144+
As a convenience, unconditional conformances will be inferred for structs and enums[^2] much of the time.
145145
When the module containing the type is built, if all of the type's fields are `BitwiseCopyable`, the compiler will generate a conformance for it to `BitwiseCopyable`.
146146

147147
For generic types, a conformance will only be inferred if its fields unconditionally conform to `BitwiseCopyable`.
148148
In the `RegularBox` example above, a conditional conformance will not be inferred.
149149
If this is desired, the developer can explicitly write the conditional conformance.
150150

151+
[^2]: This includes raw-value enums. While such enums do include a conformance to `RawRepresentable` where `RawValue` could be a non-conforming type (`String`), the instances of the enums themselves are `BitwiseCopyable`.
152+
151153
### Inference for exported types
152154

153155
This does not apply to exported (`public`, `package`, or `@usableFromInline`) types.

0 commit comments

Comments
 (0)