Skip to content

Commit d38b961

Browse files
authored
Merge pull request #82013 from glessard/rdar152615917-addressable-string-types
[stdlib] adjust addressable attribute on String type family
2 parents 49e01ba + 998b329 commit d38b961

File tree

6 files changed

+6
-10
lines changed

6 files changed

+6
-10
lines changed

stdlib/public/core/StringGuts.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ import SwiftShims
1717
// functionality and guidance for efficiently working with Strings.
1818
//
1919
@frozen
20+
@_addressableForDependencies
2021
public // SPI(corelibs-foundation)
2122
struct _StringGuts: @unchecked Sendable {
2223
@usableFromInline

stdlib/public/core/StringUTF8View.swift

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,6 @@ extension String {
8989
/// print(String(s1.utf8.prefix(15))!)
9090
/// // Prints "They call me 'B"
9191
@frozen
92-
@_addressableForDependencies
9392
public struct UTF8View: Sendable {
9493
@usableFromInline
9594
internal var _guts: _StringGuts

stdlib/public/core/Substring.swift

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -630,7 +630,6 @@ extension Substring: LosslessStringConvertible {
630630

631631
extension Substring {
632632
@frozen
633-
@_addressableForDependencies
634633
public struct UTF8View: Sendable {
635634
@usableFromInline
636635
internal var _slice: Slice<String.UTF8View>

test/SILOptimizer/lifetime_dependence/semantics.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -415,7 +415,7 @@ public func testTrivialInoutBorrow(p: inout UnsafePointer<Int>) -> Span<Int> {
415415

416416
private let immortalInt = 0
417417

418-
private let immortalString = ""
418+
private let immortalStrings: [String] = []
419419

420420
@lifetime(immortal)
421421
func testImmortalInt() -> Span<Int> {
@@ -425,10 +425,10 @@ func testImmortalInt() -> Span<Int> {
425425
}
426426

427427
@lifetime(immortal)
428-
func testImmortalString() -> Span<String> {
429-
let nilBasedBuffer = UnsafeBufferPointer<String>(start: nil, count: 0)
428+
func testImmortalStrings() -> Span<[String]> {
429+
let nilBasedBuffer = UnsafeBufferPointer<[String]>(start: nil, count: 0)
430430
let span = Span(base: nilBasedBuffer.baseAddress, count: nilBasedBuffer.count)
431-
return _overrideLifetime(span, borrowing: immortalString)
431+
return _overrideLifetime(span, borrowing: immortalStrings)
432432
}
433433

434434
let ptr = UnsafePointer<Int>(bitPattern: 1)!

test/api-digester/Outputs/stability-stdlib-source-base.swift.expected

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -363,8 +363,6 @@ Func ContiguousArray.withUnsafeMutableBufferPointer(_:) is now without rethrows
363363

364364
// Adoption of @_addressableForDependencies
365365
Struct CollectionOfOne is now with @_addressableForDependencies
366-
Struct String.UTF8View is now with @_addressableForDependencies
367-
Struct Substring.UTF8View is now with @_addressableForDependencies
368366

369367
Protocol CodingKey has added inherited protocol SendableMetatype
370368
Protocol Error has added inherited protocol SendableMetatype

test/api-digester/stability-stdlib-abi-without-asserts.test

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -825,8 +825,7 @@ Func _SliceBuffer.withUnsafeMutableBufferPointer(_:) has mangled name changing f
825825
Struct String.Index has added a conformance to an existing protocol CustomDebugStringConvertible
826826

827827
Struct CollectionOfOne is now with @_addressableForDependencies
828-
Struct String.UTF8View is now with @_addressableForDependencies
829-
Struct Substring.UTF8View is now with @_addressableForDependencies
828+
Struct _StringGuts is now with @_addressableForDependencies
830829

831830
Enum _SwiftifyInfo is a new API without '@available'
832831
Enum _SwiftifyExpr is a new API without '@available'

0 commit comments

Comments
 (0)