Skip to content

[5.9🍒] consuming cannot be applied to nonescaping closures #65707

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged

Conversation

kavon
Copy link
Member

@kavon kavon commented May 5, 2023

• Description: The net effect of this change is to tailor an error message about consuming on a Copyable type that we know is always going to be invalid. This error is specifically called out in SE-377 as something that's not allowed, so it's even emitted when using -enable-experimental-feature NoImplicitCopy, which is why a bunch of tests are now removed.
• Risk: None. It just changes a small subset of an existing error messages so they use a different message.
• Original PR: #65691
• Reviewed By: @gottesmm
• Testing: regression test included
• Resolves: rdar://108388132

According to SE-377:

consuming cannot be applied to parameters of nonescaping closure type, which by their nature are always borrowed:

// ERROR: cannot `consume` a nonescaping closure
func foo(f: consuming () -> ()) {
}

This commit implements the error message.

rdar://108388132
(cherry picked from commit 32e8987)
@kavon kavon requested a review from a team as a code owner May 5, 2023 17:59
@kavon kavon requested review from jckarter and gottesmm May 5, 2023 18:33
@kavon
Copy link
Member Author

kavon commented May 5, 2023

@swift-ci please test

@kavon kavon merged commit e4f2412 into swiftlang:release/5.9 May 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants