-
Notifications
You must be signed in to change notification settings - Fork 10.5k
Verify noescape closures for exclusivity diagnostics. #13898
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
Conversation
@swift-ci Test Source Compatibility. |
What are inout_aliasable captures actually used for these days? |
@slavapestov Incidentally, I was working on removing the |
This passed SCK testing. I think we can enable this verification now by default in debug builds. |
@swift-ci test. |
Build failed |
Build failed |
@swift-ci test. |
Build failed |
Build failed |
@atrick What does it mean for exclusivity to be part of the language model? I thought it was already. |
@slavapestov It's part of the language but the compiler can't make that assumption yet. We don't want to make it undefined behavior until there's some arbitrary level of confidence that code doesn't break it in practice. |
The test failure is unrelated to this PR. |
@atrick I see, so basically once exclusivity checking is complete you plan on changing the optimizer to start assuming it? |
@slavapestov We won't make assumptions that lead to memory unsafety or undefined behavior yet. Enforcement needs to be adequate in Swift 5 if we ever want to make those assumptions. |
@devincoughlin Does this look ok? |
Looks great! |
@swift-ci test and merge. |
Verify @inout_aliasable captures.
This is currently only done in DiagnoseStaticExclusivity because AllocBoxToStack
doesn't know how to set @NoEscape function types yet.
Negative test cases need to be added. This PR is currently just for SCK testing and review.