Skip to content

Fix an assert in exclusivity diagnostics when inouts escape. #37285

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 1 commit into from
May 7, 2021

Conversation

atrick
Copy link
Contributor

@atrick atrick commented May 6, 2021

An error found in DiagnoseInvalidEscapingCaptures can indicate invalid
SIL, which will cause DiagnoseStaticExclusivity to assert during SIL
verification. When the source-level closure captures an inout
argument, it appears in SIL to be a non-escaping closure. The SIL
verification then fails because the "nonescaping" closure actually
escapes.

Ensure that capture diagnostics run on closures before exclusivity
enforcement runs on the parent function. Bypass the SIL verification
assert if a diagnostic error was found.

Fixes rdar://75364904 (Crash with assertion noescape partial_apply has unexpected use)

An error found in DiagnoseInvalidEscapingCaptures can indicate invalid
SIL, which will cause DiagnoseStaticExclusivity to assert during SIL
verification. When the source-level closure captures an inout
argument, it appears in SIL to be a non-escaping closure. The SIL
verification then fails because the "nonescaping" closure actually
escapes.

Ensure that capture diagnostics run on closures before exclusivity
enforcement runs on the parent function. Bypass the SIL verification
assert if a diagnostic error was found.

Fixes rdar://75364904 (Crash with assertion `noescape partial_apply
has unexpected use`)
@atrick atrick requested a review from nate-chandler May 6, 2021 03:33
@atrick
Copy link
Contributor Author

atrick commented May 6, 2021

@swift-ci test

@swift-ci
Copy link
Contributor

swift-ci commented May 6, 2021

Build failed
Swift Test OS X Platform
Git Sha - b0dc18d

@atrick
Copy link
Contributor Author

atrick commented May 6, 2021

@swift-ci smoke test macOS

1 similar comment
@atrick
Copy link
Contributor Author

atrick commented May 7, 2021

@swift-ci smoke test macOS

@atrick
Copy link
Contributor Author

atrick commented May 7, 2021

1st spurious error: playgrounds
2nd spurious error: swiftpm manifest parse error

@atrick
Copy link
Contributor Author

atrick commented May 7, 2021

3rd spurious error: Driver/Dependencies/only-skip-once.swift

@atrick
Copy link
Contributor Author

atrick commented May 7, 2021

@swift-ci smoke test macOS

@atrick atrick merged commit 05e1284 into swiftlang:main May 7, 2021
@atrick atrick deleted the fix-self-capture branch May 7, 2021 16:03
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.

2 participants