[4.0] Upgrade the warning about non-escaping parameter exclusivity to an error #10991
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The restriction on the use of non-escaping closure parameters in SE-0176 was initially implemented as a warning even in Swift mode because it broke the Dispatch overlay. Dispatch has fixed their code (rdar://33065909, swiftlang/swift-corelibs-libdispatch#268), so we can now promote this to an error. It is important to promote it to an error in Swift 4 in order to make the basic exclusivity model as close as possible to what we want to commit to.
This is the swift-4.0-branch version of #10988. It is being tracked as rdar://33337020.
The patch turns a warning into an error, and only when compiling as Swift 4. Compiling as Swift 3 continues to be a warning.
The risk is low. It's possible that code will stop compiling, but only when code is being built as Swift 4, and only if the code was previously emitting a warning.
No additional testing beyond CI coverage has been performed.