Skip to content

Commit 5e050e6

Browse files
committed
[NCGenerics] fix Builtin.createAsyncTask
The SILGen emission for `Builtin.createAsyncTask` performs an existential erasure and assumed that `any Any.Type` has no protocols in its ExistentialLayout, but it's now possible to have some there with NoncopyableGenerics.
1 parent 4eccbe1 commit 5e050e6

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

lib/SILGen/SILGenBuiltin.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1557,11 +1557,16 @@ ManagedValue emitBuiltinCreateAsyncTask(SILGenFunction &SGF, SILLocation loc,
15571557
}
15581558
CanType anyTypeType =
15591559
ExistentialMetatypeType::get(ctx.TheAnyType)->getCanonicalType();
1560+
1561+
auto module = SGF.getModule().getSwiftModule();
1562+
auto conformances = module->collectExistentialConformances(futureResultType,
1563+
anyTypeType);
1564+
15601565
auto &anyTypeTL = SGF.getTypeLowering(anyTypeType);
15611566
auto &futureResultTL = SGF.getTypeLowering(futureResultType);
15621567
auto futureResultMetadata =
15631568
SGF.emitExistentialErasure(
1564-
loc, futureResultType, futureResultTL, anyTypeTL, {}, C,
1569+
loc, futureResultType, futureResultTL, anyTypeTL, conformances, C,
15651570
[&](SGFContext C) -> ManagedValue {
15661571
return ManagedValue::forObjectRValueWithoutOwnership(
15671572
SGF.B.createMetatype(loc,

0 commit comments

Comments
 (0)