@@ -67,7 +67,9 @@ extension String {
6767 /// An array containing a null-terminated sequence of UTF-8 code units.
6868 @inlinable
6969 @_alwaysEmitIntoClient
70- @available ( swift, deprecated: 6 , message: " Use String(decoding: array, as: UTF8.self) instead " )
70+ @available ( swift, deprecated: 6 , message:
71+ " Use String(decoding: array, as: UTF8.self) instead, after truncating the null termination. "
72+ )
7173 public init ( cString nullTerminatedUTF8: [ CChar ] ) {
7274 self = nullTerminatedUTF8. withUnsafeBufferPointer {
7375 $0. withMemoryRebound ( to: UInt8 . self, String . init ( _checkingCString: ) )
@@ -129,7 +131,9 @@ extension String {
129131 /// An array containing a null-terminated UTF-8 code unit sequence.
130132 @inlinable
131133 @_alwaysEmitIntoClient
132- @available ( swift, deprecated: 6 , message: " Use String(decoding: array, as: UTF8.self) instead " )
134+ @available ( swift, deprecated: 6 , message:
135+ " Use String(decoding: array, as: UTF8.self) instead, after truncating the null termination. "
136+ )
133137 public init ( cString nullTerminatedUTF8: [ UInt8 ] ) {
134138 self = nullTerminatedUTF8. withUnsafeBufferPointer {
135139 String ( _checkingCString: $0)
@@ -244,7 +248,9 @@ extension String {
244248 /// An array containing a null-terminated sequence of UTF-8 code units.
245249 @inlinable
246250 @_alwaysEmitIntoClient
247- @available ( swift, deprecated: 6 , message: " Use String(validating: array, as: UTF8.self) instead " )
251+ @available ( swift, deprecated: 6 , message:
252+ " Use String(validating: array, as: UTF8.self) instead, after truncating the null termination. "
253+ )
248254 public init ? ( validatingCString nullTerminatedUTF8: [ CChar ] ) {
249255 guard let length = nullTerminatedUTF8. firstIndex ( of: 0 ) else {
250256 _preconditionFailure (
@@ -272,7 +278,9 @@ extension String {
272278 /// An array containing a null-terminated sequence of UTF-8 code units.
273279 @inlinable
274280 @_alwaysEmitIntoClient
275- @available ( swift, deprecated: 6 , message: " Use String(validating: array, as: UTF8.self) instead " )
281+ @available ( swift, deprecated: 6 , message:
282+ " Use String(validating: array, as: UTF8.self) instead, after truncating the null termination. "
283+ )
276284 public init ? ( validatingUTF8 cString: [ CChar ] ) {
277285 self . init ( validatingCString: cString)
278286 }
@@ -491,7 +499,9 @@ extension String {
491499 /// interpreted.
492500 @inlinable
493501 @_alwaysEmitIntoClient
494- @available ( swift, deprecated: 6 , message: " Use String(decoding: array, as: Encoding.self) instead " )
502+ @available ( swift, deprecated: 6 , message:
503+ " Use String(decoding: array, as: Encoding.self) instead, after truncating the null termination. "
504+ )
495505 public init < Encoding: Unicode . Encoding > (
496506 decodingCString nullTerminatedCodeUnits: [ Encoding . CodeUnit ] ,
497507 as encoding: Encoding . Type
0 commit comments