Concurrency: Guard use of withoutActuallyEscaping() in inlinable code.

Since `withoutActuallyEscaping()` has adopted typed throws, it's no longer
visible to older compilers that do not support typed throws. We need to guard
use of the function in inlinable code to make sure the textual interface of
`_Concurrency` remains buildable with older compilers.

Resolves rdar://124352900
This commit is contained in:
Allan Shortlidge
2024-03-12 10:23:58 -07:00
parent d6d7f009a4
commit 65c0ef830e
3 changed files with 12 additions and 0 deletions

View File

@@ -174,12 +174,16 @@ extension DistributedActor {
fatalError("Incorrect actor executor assumption; Expected same executor as \(self).", file: file, line: line)
}
#if $TypedThrows
// To do the unsafe cast, we have to pretend it's @escaping.
return try withoutActuallyEscaping(operation) {
(_ fn: @escaping YesActor) throws -> T in
let rawFn = unsafeBitCast(fn, to: NoActor.self)
return try rawFn(self)
}
#else
fatalError("unsupported compiler")
#endif
}
}