File tree Expand file tree Collapse file tree 2 files changed +9
-4
lines changed Expand file tree Collapse file tree 2 files changed +9
-4
lines changed Original file line number Diff line number Diff line change @@ -316,6 +316,8 @@ extension String {
316316 unsafe String. _uncheckedFromUTF8 ( $0)
317317 }
318318#if os(watchOS) && _pointerBitWidth(_32)
319+ // Required for compatibility with some small strings that
320+ // may be encoded in the 32-bit slice of watchOS binaries.
319321 if str. _wholeGuts. isSmall,
320322 str. _wholeGuts. count > _SmallString. contiguousCapacity ( ) {
321323 new. reserveCapacity ( _SmallString. capacity + 1 )
Original file line number Diff line number Diff line change @@ -177,17 +177,20 @@ extension StringProtocol {
177177
178178// Contiguous UTF-8 strings
179179extension String {
180- /// Returns whether this string is capable of providing access to
181- /// validly-encoded UTF-8 contents in contiguous memory in O(1) time .
180+ /// Returns whether this string's storage contains
181+ /// validly-encoded UTF-8 contents in contiguous memory.
182182 ///
183- /// Contiguous strings always operate in O(1) time for withUTF8 and always
184- /// give a result for String.UTF8View.withContiguousStorageIfAvailable.
183+ /// Contiguous strings always operate in O(1) time for withUTF8, always give
184+ /// a result for String.UTF8View.withContiguousStorageIfAvailable, and always
185+ /// return a non-nil value from `String._utf8Span` and `String.utf8._span`.
185186 /// Contiguous strings also benefit from fast-paths and better optimizations.
186187 ///
187188 @_alwaysEmitIntoClient
188189 public var isContiguousUTF8 : Bool {
189190 if _guts. isFastUTF8 {
190191#if os(watchOS) && _pointerBitWidth(_32)
192+ // Required for compatibility with some small strings that
193+ // may be encoded in the 32-bit slice of watchOS binaries.
191194 if _guts. isSmall && _guts. count > _SmallString. contiguousCapacity ( ) {
192195 return false
193196 }
You can’t perform that action at this time.
0 commit comments