-
Notifications
You must be signed in to change notification settings - Fork 10.5k
[stdlib] adjust addressable attribute on String type family #82013
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[stdlib] adjust addressable attribute on String type family #82013
Conversation
@swift-ci please smoke test |
7fad0d5
to
682f904
Compare
e066e87
to
cd7bb99
Compare
@swift-ci please smoke test |
@@ -417,7 +417,7 @@ public func testTrivialInoutBorrow(p: inout UnsafePointer<Int>) -> Span<Int> { | |||
|
|||
private let immortalInt = 0 | |||
|
|||
private let immortalString = "" | |||
private let immortalStrings: [String] = [] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If String
is marked addressable, escape diagnostics behave slightly differently when it is a global. This seems incidental and could be addressed separately if it is an issue. I changed the type of this variable to get the expected diagnostics out of this test.
@swift-ci please smoke test Windows platform |
@swift-ci please smoke test Linux platform |
@@ -17,6 +17,7 @@ import SwiftShims | |||
// functionality and guidance for efficiently working with Strings. | |||
// | |||
@frozen | |||
@_addressableForDependencies |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, d'oh. Shouldn't this also be applied to _StringObject
? Substring
? The Slice
within that?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A Slice
should not need to be @_addressableForDependencies
. Only a value that has an in-line array-like representation that isn't using InlineArray
already.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My understanding was that it would be transitively applied from whatever holds a _StringGuts
(in a non-opaque way.) _StringObject
is lower, but we don't need it directly to make a span, the information from _StringGuts
is enough.
cd7bb99
to
998b329
Compare
@swift-ci please smoke test |
This rearranges the
@_addressableForDependencies
attributes in theString
family to be applied to_StringGuts
, which is where the information is located. Other types inherit the characteristic transitively.Addresses rdar://152615917