Skip to content

Pseudo-cherry-pick https://github.com/apple/swift/commit/96691208e9b8… #21807

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

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 2 additions & 5 deletions stdlib/public/core/StringBridge.swift
Original file line number Diff line number Diff line change
Expand Up @@ -302,12 +302,9 @@ extension String {
// The @_swift_native_objc_runtime_base attribute
// This allows us to subclass an Objective-C class and use the fast Swift
// memory allocator.
@_fixed_layout // FIXME(sil-serialize-all)
@objc @_swift_native_objc_runtime_base(__SwiftNativeNSStringBase)
public class __SwiftNativeNSString {
@usableFromInline // FIXME(sil-serialize-all)
@objc
internal init() {}
class __SwiftNativeNSString {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should try and keep all access explicit, so this should have an internal (doesn't need to happen in this PR tho)

@objc internal init() {}
deinit {}
}

Expand Down
5 changes: 2 additions & 3 deletions stdlib/public/core/StringStorage.swift
Original file line number Diff line number Diff line change
Expand Up @@ -76,9 +76,8 @@ extension _AbstractStringStorage {
fallthrough
case (_cocoaUTF8Encoding, _):
guard maxLength >= count + 1 else { return 0 }
let buffer =
UnsafeMutableBufferPointer(start: outputPtr, count: maxLength)
buffer.initialize(from: UnsafeBufferPointer(start: start, count: count))
let buffer = UnsafeMutableBufferPointer(start: outputPtr, count: maxLength)
_ = buffer.initialize(from: UnsafeBufferPointer(start: start, count: count))
buffer[count] = 0
return 1
default:
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@

Class __SwiftNativeNSString has been removed