Skip to content

Commit 4794ead

Browse files
authored
Merge pull request #13693 from atrick/unsafecast-comment
2 parents d41eedc + 674e9d6 commit 4794ead

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

lib/SIL/SILType.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,10 @@ bool SILType::isPointerSizeAndAligned() {
119119
// struct {A, B, C} -> struct {A, B} is castable
120120
// struct { struct {A, B}, C} -> struct {A, B} is castable
121121
// struct { A, B, C} -> struct { struct {A, B}, C} is NOT castable
122+
//
123+
// FIXME: This is unnecessarily conservative given the current ABI
124+
// (TypeLayout.rst). It would be simpler to flatten both `from` and `to` types,
125+
// exploding all structs and tuples, then trivially check if `to` is a prefix.
122126
static bool canUnsafeCastStruct(SILType fromType, StructDecl *fromStruct,
123127
SILType toType, SILModule &M) {
124128
auto fromRange = fromStruct->getStoredProperties();

0 commit comments

Comments
 (0)