[SR-2970] @noescape local variable closures will no longer be possible once @noescape is fully removed from the language #45560
Labels
bug
A deviation from expected or documented behavior. Also: expected but undesirable behavior.
compiler
The Swift compiler in itself
regression
swift 3.0
Environment
Xcode 8 (8A218a) Apple Swift version 3.0 (swiftlang-800.0.46.2 clang-800.0.38)
Target: x86_64-apple-macosx10.9
Additional Detail from JIRA
md5: b5605ab57aaec004648adef2dce69be4
Issue Description:
Currently in Swift 3.0, although @NoEscape is deprecated, and to be removed - you can mark a local variable closure in a function with the @NoEscape attribute, allowing it to capture other non-escaping closures.
Removing the @NoEscape attribute will trigger a compiler error stating that the non-escaping parameter cannot be captured in a potentially escaping closure.
With the @NoEscape attribute present, the compiler will correctly enforce that f is non-escaping, by preventing it from escaping the lifetime of the function foo:
However, once @NoEscape is fully removed from the language, this will no longer be possible.
The text was updated successfully, but these errors were encountered: