Skip to content

[6.1] Fix SILGenFunction::emitValueConstructor for library evolution. #78569

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
Jan 15, 2025

Conversation

atrick
Copy link
Contributor

@atrick atrick commented Jan 11, 2025

Always call createMarkUnresolvedNonCopyableValueInst for a constructor with move-only 'self'. Handle 'self' that is either returned by value or as an indirect result

Fixes rdar://142690658 (In ~Copyable public struct, an init with COW type param causes compiler error)

(cherry picked from commit f05a8fa)

Explanation: Incorrect SIL is generated for a ~Copyable type's initializer resulting in the error: "Copy of noncopyable typed value". This appears to be an oversight in SILGen. A marker instruction needs to be emitted to trigger move checking. Otherwise, SIL contains a copy of the ~Copyable type.

Scope: In 6.1, for release compilers, with -enable-library-evolution, this error occurs for any public ~Copyable type with an initializer.

Radar/SR Issue: rdar://142690658 (In ~Copyable public struct, an init with COW type param causes compiler error)

Original PR: #78568

Risk: Low. The affected SILGen path already generates a compiler error.

Testing: Source-level unit test.

Reviewer: @jckarter

@atrick atrick added 🍒 release cherry pick Flag: Release branch cherry picks swift 6.1 labels Jan 11, 2025
@atrick atrick requested a review from jckarter January 11, 2025 00:32
@atrick atrick requested a review from a team as a code owner January 11, 2025 00:32
@atrick
Copy link
Contributor Author

atrick commented Jan 11, 2025

@swift-ci test

Always call createMarkUnresolvedNonCopyableValueInst for a constructor
with move-only 'self'. Handle 'self' that is either returned by value
or as an indirect result

Fixes rdar://142690658 (In ~Copyable public struct,
an init with COW type param causes compiler error)

(cherry picked from commit fe075dc)
@atrick atrick force-pushed the 6.1-fix-silgen-noncopyable branch from 7601283 to adaed21 Compare January 11, 2025 03:08
@atrick
Copy link
Contributor Author

atrick commented Jan 11, 2025

@swift-ci test

@atrick
Copy link
Contributor Author

atrick commented Jan 11, 2025

@tbkka approval needed

@atrick atrick merged commit f68e93b into swiftlang:release/6.1 Jan 15, 2025
5 checks passed
@atrick atrick deleted the 6.1-fix-silgen-noncopyable branch January 15, 2025 18:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🍒 release cherry pick Flag: Release branch cherry picks swift 6.1
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants