Skip to content

Commit 0fc297e

Browse files
committed
Fix assertions: don't invariantCheck() until code units are initialized
1 parent ca84292 commit 0fc297e

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

stdlib/public/core/StringStorage.swift

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,9 @@ extension _StringStorage {
186186

187187
storage._breadcrumbsAddress.initialize(to: nil)
188188
storage.terminator.pointee = 0 // nul-terminated
189-
storage._invariantCheck()
189+
190+
// NOTE: We can't _invariantCheck() now, because code units have not been
191+
// initialized. But, _StringGuts's initializer will.
190192
return storage
191193
}
192194

0 commit comments

Comments
 (0)