-
Notifications
You must be signed in to change notification settings - Fork 10.5k
[Distributed] Survive generics with Sendable requirement in executeDistributedTarget #41854
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
Conversation
7a2e0cf
to
ae36adb
Compare
…stTarget resolves rdar://90293494
ae36adb
to
a249ccd
Compare
for (const auto &req : requirements) { | ||
// Make sure we understand the requirement we're dealing with. | ||
if (!req.hasKnownKind()) | ||
return TypeLookupError("unknown kind"); | ||
if (!req.hasKnownKind()) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
so the kind here ends up being some weird 24 for the Sendable requirement...
Since it has an unknown kind we can't really get the mangled name or protocol etc to check it in detail if it is the exact sendable.
But the same issue would happen with any other @_marker protocol I suppose...
@swift-ci please smoke test |
/// \param skipUnknownKinds If true, unknown requirement kinds will not be | ||
/// reported as errors. This should used with care, and e.g. only to ignore | ||
/// @_marker protocols at runtime, which cannot be checked at runtime. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In the future, should we consider a runtime representation that indicates the requirement came from a marker protocol? Having any representation at runtime sounds like it goes against the purpose of a marker protocol, but I guess that was unavoidable in this case?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ignoring/skipping Sendable requirements at this level shouldn't be necessary. Rather, we shouldn't mangle the Sendable
requirements at all, so we don't need to demangle them. ASTMangler has an option, AllowMarkerProtocols
, that you can set to false
so that the mangler skips over any marker protocols when it mangles.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks good to me. The only concern I had was with the mixing of concepts: "unknown kind" with "marker protocol". But, I don't currently know of any better way to implement this fix.
@DougGregor This is not going to be as easy as mangling, generic environment descriptor @ktoso If you don't mind I'd like to take over fixing this issue. |
I see... thanks a lot, that makes sense @DougGregor . Thanks for the help @xedin ! |
Replaced by #41871 |
Since
Sendable
as any other @_marker protocol does not exist at runtime, we're not able (and DON'T HAVE TO) find a witness for it. The function we're to invoke does not expect a witness for those anyway.I did not find a way to detect "oh, this was a marker protocol" so instead I provide a mode to ignore unknown kinds. We only use it in our code so there should be no risk to other existing code.
resolves rdar://90293494