Skip to content

Conversation

@xedin
Copy link
Contributor

@xedin xedin commented Nov 18, 2025

This proposal introduces ~Sendable conformance syntax to explicitly suppress a conformance to Sendable, which would prevent automatic Sendable inference on types, and provide an alternative way to mark types as non-Sendable without inheritance impact.

This proposal introduces `~Sendable` conformance syntax to explicitly
suppress a conformance to Sendable, which would prevent automatic
`Sendable` inference on types, and provide an alternative way to mark
types as non-`Sendable` without inheritance impact.
```swift
// Actors are always `Sendable`.
actor A: ~Sendable { // error: cannot both conform to and suppress conformance to 'Sendable'
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see you've included this case already as well as GAITs below, based on pitch feedback. It would be good to assure ourselves that the text is now complete in terms of covering how the feature interacts with all of the inference rules applicable to Sendable and not found on BitwiseCopyable (or other suppressible protocols).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How do you propose we do that?

Copy link
Contributor

@xwu xwu Dec 10, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know of a foolproof way, but as a starting point I'd imagine one could go through each of the inference rules for Sendable in SE-0302 and SE-0418 [edit: as references to read and consider, not to repeat in this text], then following through to other inference rules incorporated by reference (for example: given actors imply Sendable, then look to actor inference rules).

Looking at SE-0302, for example, it occurs to me that for completeness one might want to state that tuples cannot have their inferred Sendable conformance disabled. And since this proposal prohibits using ~Sendable in scenarios such as generic constraints, one thing we might want to be certain of is that the inference rules for those constraints don't infer Sendable (e.g., for key paths) in a way that a user might want to disable and cannot.

Even if it can't be 100%, that some effort has been made along these lines would no doubt help to round out the completeness of the proposal text by pointing out scenarios where some subtlety is underspecified or just worth clarifying.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds good. I added a paragraph to that matter in cd10dee.

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.

2 participants