Skip to content

[5.9] SILGen: Don't copy a borrowed noncopyable address-only base of a computed property access. #66475

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

jckarter
Copy link
Contributor

@jckarter jckarter commented Jun 8, 2023

Issue: rdar://109161396
• Explanation: Accessing a computed property on an "address-only" noncopyable type would crash the compiler and/or raise a spurious "borrowed value cannot be consumed" error trying to consume the base.
• Scope of Issue: Fixes a compiler crash and reject-valid bug.
• Origination: Noncopyable types feature work.
• Risk: Low. The fix targets a specific code pattern only when using noncopyable types, for code that currently crashes the compiler. Potential miscompiles ought to be diagnosed by the move-only checker, so that they do not lead to accidentally successful compiles.
• Reviewed By: @gottesmm
• Automated Testing: Swift CI
• Dependencies: None
• Builder Impact: Not applicable
• Directions for QE: None

…uted property access.

We can probably avoid this copy in more circumstances, but make the change only for
noncopyable types for now, since that's the case where it's most semantically apparent.
rdar://109161396
@jckarter jckarter requested a review from a team as a code owner June 8, 2023 22:02
@jckarter
Copy link
Contributor Author

jckarter commented Jun 8, 2023

@swift-ci Please test

@jckarter jckarter merged commit 31d0e23 into swiftlang:release/5.9 Jun 9, 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.

2 participants