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