Skip to content

🍒[5.10][Distributed] Generic reqs must be forwarded to accessor from enclosing actor #68861

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

ktoso
Copy link
Contributor

@ktoso ktoso commented Sep 29, 2023

Issue: Without this change, in debug builds the requirement machine validation infra would crash to compile. This prevents advanced Distributed Actors users with lots of generics from using NIGHTLY builds. Stable builds have this assertion turned off.

Description: If we don't do this, the generic parameter has no requirements at all, which a) is incorrect to begin with, it should have the exact same signature as the method it is the accessor for, and b) it would trip up verification which is enabled on linux in snapshot builds -- causing crashes.

Affected versions: All the way since initial introduction, but ONLY in debug builds -- i.e. nightly snapshots on linux. Released stable Swift versions don't have this assertion and would "happen to work".

Risk: Low, this only adds missing requirements to distributed function accessors which is the correct thing to do. Missing them "worked by accident".

Review by: @slavapestov @xedin

Testing: CI testing; verified manually on reproducer project provided in issue

Radar: rdar://115497090

Original PR: #68859 #70785

Resolves #68517

@ktoso ktoso requested a review from a team as a code owner September 29, 2023 06:32
@ktoso
Copy link
Contributor Author

ktoso commented Sep 29, 2023

@swift-ci please test

@hassila
Copy link

hassila commented Dec 14, 2023

Friendly ping - if possible we'd like to be able to tests nightly toolchains on Linux too :-)

…ng actor

If we don't do this, the generic parameter has no requirements at all,
which a) is incorrect to begin with, it should have the exact same
signature as the method it is the accessor for, and b) it would trip up
verification which is enabled on linux in snapshot builds -- causing
crashes.

Resolves rdar://115497090
@ktoso ktoso force-pushed the pick-generic-reqs-from-actor-da-for-accessor branch from 8c12111 to 20206d5 Compare January 9, 2024 08:05
@ktoso
Copy link
Contributor Author

ktoso commented Jan 9, 2024

@swift-ci please test

@ktoso ktoso added the distributed Feature → concurrency: distributed actor label Jan 9, 2024
// and also forward all requirements this generic parameter might have.
for (auto req : actor->getGenericRequirements()) {
if (req.getFirstType()->isEqual(genericParam)) {
genericRequirements.push_back(req);
Copy link
Contributor

Choose a reason for hiding this comment

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

Please cherry pick the corrected version from main that uses buildGenericSignature() and preserves all generic requirements, not just those whose subject type is exactly equal to an innermost generic parameter.

Copy link
Contributor Author

@ktoso ktoso Jan 10, 2024

Choose a reason for hiding this comment

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

Thanks Slava, slight de-javu actually indeed... we worked on this in #69502 which already made it to 5.10.

I'll re-evaluate what we're missing and if we even needed this type change still.

@ktoso ktoso marked this pull request as draft January 10, 2024 03:21
@ktoso ktoso closed this Jan 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
distributed Feature → concurrency: distributed actor
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants