[SR-8955] Can't use DispatchWorkItem with a non-escaping block #51460
Labels
access control
Feature → modifiers: Access control and access levels
bug
A deviation from expected or documented behavior. Also: expected but undesirable behavior.
compiler
The Swift compiler in itself
regression
swift 4.2
Environment
Xcode Version 10.0 (10A255)
Puzzlingly, only reproduces on certain devices
Additional Detail from JIRA
md5: 15e0cca8d472b4dfe08f7a378260204f
Issue Description:
I am currently trying to do something like this (swift 4.1)
This block should not escape in practice because it is sent to the queue with
sync
however swift's local inference rules are not powerful enough to understand my argument. withoutActuallyEscaping used to solve this, however on swift 4.2 this produces at runtimeclosure argument was escaped in withoutActuallyEscaping block
I wondered how you guys solve this, and I checked and found there is an internal I-solmently-swear-I'm-up-to-no-good constructor:
IMO either this constructor should be public API, or there should be some language feature to disable this assert, or the assert should be smart enough to realize this doesn't actually escape (or am I the idiot and it escapes here somehow after all?)
The text was updated successfully, but these errors were encountered: