Skip to content

Include missing _getMainExecutor and _asyncMainDrainQueue in concurrency swiftinterface #40221

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

etcwilde
Copy link
Member

@etcwilde etcwilde commented Nov 17, 2021

While the API are in swift modules and in the standard library, they are not included in the swift interface file because they are internal. By marking the API as @usableFromInline, they are included in the swift interface file.

I added the ability to generate the declaration for _getMainExecutor in #39941, I missed _asyncMainDrainQueue, so I've added that here. It shouldn't be necessary when the compiler is paired up with the correct version of the standard library, but it appears that's not always happening, so this is taking care of both of those issues.

I've manually inspected the resulting swift interface file generated locally and have ensured that the correct declarations are emitted:

@available(macOS 10.15, iOS 13.0, watchOS 6.0, tvOS 13.0, *)
@usableFromInline
@_silgen_name("swift_task_asyncMainDrainQueue")
internal func _asyncMainDrainQueue() -> Swift.Never

#if compiler(>=5.3) && $BuiltinExecutor
@available(macOS 10.15, iOS 13.0, watchOS 6.0, tvOS 13.0, *)
@usableFromInline
@_silgen_name("swift_task_getMainExecutor")
internal func _getMainExecutor() -> Builtin.Executor
#endif

The asyncMainDrainQueue is also declared `internal`, so it won't show up
in the swiftinterface file.

The expected declaration is:

```
@available(SwiftStdlib 5.5, *)
@_silgen_name("swift_task_asyncMainDrainQueue")
internal func _asyncMainDrainQueue() -> Never
```
getMainExecutor and asyncMainDrainQueue function declarations are needed
to compile programs with the asyn-main function. The functions are
declared internal, so they don't show up in the swift interface files.
@etcwilde etcwilde requested a review from DougGregor November 17, 2021 05:41
@etcwilde
Copy link
Member Author

@swift-ci please test

@etcwilde etcwilde merged commit 05fa143 into swiftlang:main Nov 18, 2021
@etcwilde etcwilde deleted the ewilde/include-missing-api-in-swinterface branch November 18, 2021 17:48
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