-
Notifications
You must be signed in to change notification settings - Fork 10.5k
Fix static exclusivity verification for withoutActuallyEscaping. #18708
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. |
@swift-ci test source compatibility. |
Build failed |
@swift-ci smoke test. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! But, can you please update convert_function
's documentation in SIL.rst
?
ConvertFunction and reabstraction thunks need this attribute. Otherwise, there is no way to identify that withoutActuallyEscaping was used to explicitly perform a conversion. The destination of a [without_actually_escaping] conversion always has an escaping function type. The source may have either an escaping or @NoEscape function type. The conversion itself may be a nop, and there is nothing distinctive about it. The thing that is special about these conversions is that the source function type may have unboxed captures. i.e. they have @inout_aliasable parameters. Exclusivity requires that the compiler enforce a SIL data flow invariant that nonescaping closures with unboxed captures can never be stored or passed as an @escaping function argument. Adding this attribute allows the compiler to enforce the invariant in general with an escape hatch for withoutActuallyEscaping.
DiagnoseStaticExclusivity no longer asserts as follows when non-escaping closures are passed to withoutActuallyEscaping: Applied argument must be @NoEscape function type: ... A partial_apply with @inout_aliasable may only be used as a @NoEscape function type argument. Subsequent commits will improve diagnostics to detect actual conflicts in these situations. Fixes <rdar://problem/43059088> Assertion in DiagnoseStaticExclusivity.
@shajrawi thanks, I almost forgot! |
@swift-ci smoke test. |
Add a SIL attribute [without_actually_escaping].
Teach static exclusivity verification about withoutActuallyEscaping.
Fixes rdar://problem/43059088 Assertion in DiagnoseStaticExclusivity.