Skip to content

stdlib: Fix more typed throws and non-copyable generics condfails #73306

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 1 commit into from
Apr 27, 2024
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
6 changes: 4 additions & 2 deletions stdlib/public/core/LifetimeManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,9 @@ public func withExtendedLifetime<T: ~Copyable, Result: ~Copyable>(
}

@_spi(SwiftStdlibLegacyABI) @available(swift, obsoleted: 1)
@_silgen_name("$ss20withExtendedLifetimeyq_x_q_yKXEtKr0_lF")
@usableFromInline
internal func withExtendedLifetime<T, Result>(
internal func __abi_withExtendedLifetime<T, Result>(
_ x: T,
_ body: () throws -> Result // FIXME: Typed throws rdar://126576356
) rethrows -> Result {
Expand All @@ -56,8 +57,9 @@ public func withExtendedLifetime<T, Result: ~Copyable>(
}

@_spi(SwiftStdlibLegacyABI) @available(swift, obsoleted: 1)
@_silgen_name("$ss20withExtendedLifetimeyq_x_q_xKXEtKr0_lF")
@usableFromInline
internal func withExtendedLifetime<T, Result>(
internal func __abi_withExtendedLifetime<T, Result>(
_ x: T, _ body: (T) throws -> Result // FIXME: Typed throws rdar://126576356
) rethrows -> Result {
defer { _fixLifetime(x) }
Expand Down
4 changes: 2 additions & 2 deletions stdlib/public/core/Optional.swift
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ extension Optional where Wrapped: ~Copyable {
) throws(E) -> U? {
#if $NoncopyableGenerics
switch self {
case .some(borrowing y):
case .some(_borrowing y):
return .some(try transform(y))
case .none:
return .none
Expand Down Expand Up @@ -316,7 +316,7 @@ extension Optional where Wrapped: ~Copyable {
_ transform: (borrowing Wrapped) throws(E) -> U?
) throws(E) -> U? {
switch self {
case .some(borrowing y):
case .some(_borrowing y):
return try transform(y)
case .none:
return .none
Expand Down
8 changes: 5 additions & 3 deletions stdlib/public/core/Result.swift
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,9 @@ extension Result {
}

@_spi(SwiftStdlibLegacyABI) @available(swift, obsoleted: 1)
@_silgen_name("$ss6ResultO3mapyAByqd__q_Gqd__xXElF")
@usableFromInline
internal func map<NewSuccess>(
internal func __abi_map<NewSuccess>(
_ transform: (Success) -> NewSuccess
) -> Result<NewSuccess, Failure> {
switch self {
Expand Down Expand Up @@ -205,8 +206,9 @@ extension Result {
}

@_spi(SwiftStdlibLegacyABI) @available(swift, obsoleted: 1)
@_silgen_name("$ss6ResultO7flatMapyAByqd__q_GADxXElF")
@usableFromInline
internal func flatMap<NewSuccess>(
internal func __abi_flatMap<NewSuccess>(
_ transform: (Success) -> Result<NewSuccess, Failure>
) -> Result<NewSuccess, Failure> {
switch self {
Expand Down Expand Up @@ -272,7 +274,7 @@ extension Result {
@_spi(SwiftStdlibLegacyABI) @available(swift, obsoleted: 1)
@_silgen_name("$ss6ResultO12flatMapErroryAByxqd__GADq_XEs0D0Rd__lF")
@usableFromInline
internal func flatMapError<NewFailure>(
internal func __abi_flatMapError<NewFailure>(
_ transform: (Failure) -> Result<Success, NewFailure>
) -> Result<Success, NewFailure> {
switch self {
Expand Down