Skip to content

Commit 0a78621

Browse files
[DiscardingTG] Fix runtime signature mismatch for statically known -> Void closure
Since swiftlang#65613, DiscardingTG started to accept `() -> Void` instead of `() -> T`, but it also changed the number of arguments accepted by the closure from 3 to 2. So it should use `non_future_adapter` instead of `future_adapter` to avoid runtime signature mismatch.
1 parent ef963c3 commit 0a78621

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

stdlib/public/Concurrency/Task.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -832,7 +832,7 @@ static AsyncTaskAndContext swift_task_create_commonImpl(
832832
// the async context to get at the parameters.
833833
// See e.g. FutureAsyncContextPrefix.
834834

835-
if (!futureResultType) {
835+
if (!futureResultType || taskCreateFlags.isDiscardingTask()) {
836836
auto asyncContextPrefix = reinterpret_cast<AsyncContextPrefix *>(
837837
reinterpret_cast<char *>(allocation) + headerSize -
838838
sizeof(AsyncContextPrefix));

0 commit comments

Comments
 (0)