Skip to content

[SE-0470] Prohibit isolated conformances in dynamic casts that can't safely use them #80337

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

Conversation

DougGregor
Copy link
Member

When performing a dynamic cast to an existential type that satisfies (Metatype)Sendable, it is unsafe to allow isolated conformances of any kind to satisfy protocol requirements for the existential. Identify these cases and mark the corresponding cast instructions in SIL with a new flag, [prohibit_isolated_conformances] that will be used to indicate to the
runtime that isolated conformances need to be rejected. Update the runtime to respect this flag, in which case it rejects all attempts to use an isolated conformance.

…mances" flag

When performing a dynamic cast to an existential type that satisfies
(Metatype)Sendable, it is unsafe to allow isolated conformances of any
kind to satisfy protocol requirements for the existential. Identify
these cases and mark the corresponding cast instructions with a new flag,
`[prohibit_isolated_conformances]` that will be used to indicate to the
runtime that isolated conformances need to be rejected.
Certain dynamic casts cannot work safely with isolated conformances,
regardless of what executor the code runs on. For such cases, reject
all attempts to conform to the type.
@DougGregor
Copy link
Member Author

@swift-ci please smoke test

@DougGregor DougGregor enabled auto-merge March 27, 2025 05:33
@DougGregor
Copy link
Member Author

@swift-ci please smoke test

@DougGregor
Copy link
Member Author

@swift-ci please smoke test macOS

@DougGregor DougGregor merged commit a61c400 into swiftlang:main Mar 27, 2025
3 checks passed
@DougGregor DougGregor deleted the cast-prohibits-isolated-conformances branch March 27, 2025 23:07
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.

1 participant