@@ -245,9 +245,13 @@ static void swift_asyncLet_getImpl(SWIFT_ASYNC_CONTEXT AsyncContext *callerConte
245245}
246246
247247struct AsyncLetContinuationContext : AsyncContext {
248- AsyncLet *alet;
248+ AsyncLet *alet;
249+ OpaqueValue *resultBuffer;
249250};
250251
252+ static_assert (sizeof (AsyncLetContinuationContext) <= sizeof (TaskFutureWaitAsyncContext),
253+ " compiler provides the same amount of context space to each" );
254+
251255SWIFT_CC (swiftasync)
252256static void _asyncLet_get_throwing_continuation(
253257 SWIFT_ASYNC_CONTEXT AsyncContext *callContext,
@@ -369,8 +373,7 @@ static void _asyncLet_finish_continuation(
369373 auto continuationContext
370374 = reinterpret_cast <AsyncLetContinuationContext*>(callContext);
371375 auto alet = continuationContext->alet ;
372- auto resultBuffer = asImpl (alet)->getFutureContext ()
373- ->successResultPointer ;
376+ auto resultBuffer = continuationContext->resultBuffer ;
374377
375378 // Destroy the error, or the result that was stored to the buffer.
376379 if (error) {
@@ -415,6 +418,7 @@ static void swift_asyncLet_finishImpl(SWIFT_ASYNC_CONTEXT AsyncContext *callerCo
415418 aletContext->Parent = callerContext;
416419 aletContext->ResumeParent = resumeFunction;
417420 aletContext->alet = alet;
421+ aletContext->resultBuffer = reinterpret_cast <OpaqueValue*>(resultBuffer);
418422 auto futureContext = asImpl (alet)->getFutureContext ();
419423
420424 // TODO: It would be nice if we could await the future without having to
0 commit comments