Skip to content

[Concurrency] Adopt stable keyword consuming instead of __owned #65571

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
merged 1 commit into from
May 12, 2023

Conversation

ktoso
Copy link
Contributor

@ktoso ktoso commented May 2, 2023

This change is ABI stable with regards to the mangled name of the enqueue method.

We confirmed this by manually comparing mangled names of a method with __owned and later a consuming parameter -- please double check this though @kavon as you'd know more about this than myself.

This also improves diagnostics around implementing move-only job requirement, since the diagnostics offered by __owned are wrong: they don't show the attribute leading people to add func enqueue(_ job: ExecutorJob) which is incorrect because they MUST add consuming.

This PR includes tests that simulate an SDK with either the __owned or consuming versions and implementations with the other spelling, to make sure this works as expected.

Please review @kavon

Resolves rdar://108467550

@ktoso ktoso requested review from hborla, slavapestov and xedin as code owners May 2, 2023 03:56
Copy link
Member

@kavon kavon left a comment

Choose a reason for hiding this comment

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

At least on main, there doesn't appear to be any issue with having an __owned parameter requirement being witnessed by a consuming method's parameter.

So far I think it's fine to change the methods as those won't lead to any ABI break, but...

@ktoso ktoso requested a review from kavon May 2, 2023 04:40
@ktoso ktoso force-pushed the wip-consuming-keyword-job branch 2 times, most recently from b068a4c to 5455f33 Compare May 2, 2023 04:46
@ktoso
Copy link
Contributor Author

ktoso commented May 2, 2023

@swift-ci please smoke test

@ktoso
Copy link
Contributor Author

ktoso commented May 2, 2023

@swift-ci please smoke test

@ktoso
Copy link
Contributor Author

ktoso commented May 2, 2023

Depends on #65455 since that introduces new methods; so we want to do the same to the new ones IF we are to merge these new methods.

@ktoso ktoso requested a review from kavon May 2, 2023 05:46
@ktoso
Copy link
Contributor Author

ktoso commented May 2, 2023

@swift-ci please smoke test macOS

@ktoso ktoso force-pushed the wip-consuming-keyword-job branch 3 times, most recently from 29cffc7 to 51db03f Compare May 11, 2023 13:16
add test for warnings emitted when missing consuming attribute

use -emit-sil in mock SDK tests for better coverage
@ktoso ktoso force-pushed the wip-consuming-keyword-job branch from 51db03f to da6f08a Compare May 11, 2023 13:19
@ktoso
Copy link
Contributor Author

ktoso commented May 11, 2023

@swift-ci please smoke test

@ktoso
Copy link
Contributor Author

ktoso commented May 11, 2023

@swift-ci please smoke test Windows

@ktoso ktoso merged commit 8fbbf8d into swiftlang:main May 12, 2023
@ktoso ktoso deleted the wip-consuming-keyword-job branch May 12, 2023 19:03
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