@@ -247,9 +247,13 @@ static void swift_asyncLet_getImpl(SWIFT_ASYNC_CONTEXT AsyncContext *callerConte
247
247
}
248
248
249
249
struct AsyncLetContinuationContext : AsyncContext {
250
- AsyncLet *alet;
250
+ AsyncLet *alet;
251
+ OpaqueValue *resultBuffer;
251
252
};
252
253
254
+ static_assert (sizeof (AsyncLetContinuationContext) <= sizeof(TaskFutureWaitAsyncContext),
255
+ "compiler provides the same amount of context space to each");
256
+
253
257
SWIFT_CC (swiftasync)
254
258
static void _asyncLet_get_throwing_continuation(
255
259
SWIFT_ASYNC_CONTEXT AsyncContext *callContext,
@@ -370,8 +374,7 @@ static void _asyncLet_finish_continuation(
370
374
auto continuationContext
371
375
= reinterpret_cast <AsyncLetContinuationContext*>(callContext);
372
376
auto alet = continuationContext->alet ;
373
- auto resultBuffer = asImpl (alet)->getFutureContext ()
374
- ->successResultPointer ;
377
+ auto resultBuffer = continuationContext->resultBuffer ;
375
378
376
379
// Destroy the error, or the result that was stored to the buffer.
377
380
if (error) {
@@ -416,6 +419,7 @@ static void swift_asyncLet_finishImpl(SWIFT_ASYNC_CONTEXT AsyncContext *callerCo
416
419
aletContext->Parent = callerContext;
417
420
aletContext->ResumeParent = resumeFunction;
418
421
aletContext->alet = alet;
422
+ aletContext->resultBuffer = reinterpret_cast <OpaqueValue*>(resultBuffer);
419
423
auto futureContext = asImpl (alet)->getFutureContext ();
420
424
421
425
// TODO: It would be nice if we could await the future without having to
0 commit comments