Skip to content

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

Merged
merged 2 commits into from
Aug 15, 2018
Merged

Fix static exclusivity verification for withoutActuallyEscaping. #18708

merged 2 commits into from
Aug 15, 2018

Conversation

atrick
Copy link
Contributor

@atrick atrick commented Aug 14, 2018

Add a SIL attribute [without_actually_escaping].

Teach static exclusivity verification about withoutActuallyEscaping.

Fixes rdar://problem/43059088 Assertion in DiagnoseStaticExclusivity.

@atrick
Copy link
Contributor Author

atrick commented Aug 14, 2018

@swift-ci test.

@atrick
Copy link
Contributor Author

atrick commented Aug 14, 2018

@swift-ci test source compatibility.

@atrick
Copy link
Contributor Author

atrick commented Aug 14, 2018

@shajrawi I'm looking for a bug fix review here.

Also, @jckarter may be interested.

@swift-ci
Copy link
Contributor

Build failed
Swift Test Linux Platform
Git Sha - 9cc335398f1d29d1e856be6a75a7ed2ffe460e1e

@atrick
Copy link
Contributor Author

atrick commented Aug 14, 2018

@swift-ci smoke test.

@atrick atrick requested a review from shajrawi August 14, 2018 23:06
Copy link

@shajrawi shajrawi left a 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?

atrick added 2 commits August 14, 2018 17:14
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.
@atrick
Copy link
Contributor Author

atrick commented Aug 15, 2018

@shajrawi thanks, I almost forgot!

@atrick
Copy link
Contributor Author

atrick commented Aug 15, 2018

@swift-ci smoke test.

@atrick atrick merged commit b3c66cc into swiftlang:master Aug 15, 2018
@atrick atrick deleted the without-actually-asserting branch February 22, 2019 17:30
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