mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
The new intrinsic, exposed via static functions on Task<T, Never> and Task<T, Error> (rethrowing), begins an asynchronous context within a synchronous caller's context. This is only available for use under the task-to-thread concurrency model, and even then only under SPI.
22 lines
611 B
Swift
22 lines
611 B
Swift
// RUN: %target-build-swift -parse-as-library -Xfrontend -disable-availability-checking -module-name a %s -o %t.out
|
|
// RUN: %target-codesign %t.out
|
|
// RUN: %target-run %t.out
|
|
|
|
// REQUIRES: executable_test
|
|
// REQUIRES: freestanding
|
|
// REQUIRES: concurrency
|
|
// REQUIRES: concurrency_runtime
|
|
|
|
// This test should always exit with a non-zero code.
|
|
// XFAIL: *
|
|
|
|
@_spi(_TaskToThreadModel) import _Concurrency
|
|
|
|
@main struct Main {
|
|
static func main() async {
|
|
// Check that we crash when calling runInline from within an async context--
|
|
// here the async context of an async @main.
|
|
Task.runInline {}
|
|
}
|
|
}
|