Avatar
Avatar
omochimetaru
@swift-6.2.3 @swift-6.1.3 @swift-6.0.3 -swift-version 6 import Synchronization class C { var x = 0 } final class D: Sendable { let _c: Mutex<C?> = Mutex(C()) func getC() -> C? { _c.withLock { $0 } } }
exit status 1 with stderr:<stdin>:11:26: error: 'inout sending' parameter '$0' cannot be task-isolated at end of function 9 | 10 | func getC() -> C? { 11 | _c.withLock { $0 } | |- error: 'inout sending' parameter '$0' cannot be task-isolated at end of function | `- note: task-isolated '$0' risks causing races in between task-isolated uses and caller uses since caller assumes value is not actor isolated 12 | } 13 | }