Skip to content

Commit 5b716bd

Browse files
committed
[string] sanity check for runtime size
1 parent 38190fa commit 5b716bd

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

stdlib/public/core/StringGuts.swift

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,19 @@ extension _StringGuts {
8484
} else {
8585
fatalError("Unimplemented string form")
8686
}
87+
88+
#if arch(i386) || arch(arm)
89+
_sanityCheck(MemoryLayout<String>.size == 12, """
90+
the runtime is depending on this, update Reflection.mm and \
91+
this if you change it
92+
""")
93+
#else
94+
_sanityCheck(MemoryLayout<String>.size == 16, """
95+
the runtime is depending on this, update Reflection.mm and \
96+
this if you change it
97+
""")
98+
#endif
99+
87100
#endif // INTERNAL_CHECKS_ENABLED
88101
}
89102

0 commit comments

Comments
 (0)