-
Notifications
You must be signed in to change notification settings - Fork 10.5k
Copyable as a Requirement Against the Machine #67930
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
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
slavapestov
reviewed
Aug 15, 2023
Also |
d05ba66
to
dc1bf91
Compare
slavapestov
reviewed
Sep 8, 2023
slavapestov
reviewed
Sep 8, 2023
An initial implementation of a rework in how we prevent noncopyable types from being substituted in places they are not permitted. Instead of generating a constraint for every generic parameter in the solver, we produce real Copyable conformance requirements. This is much better for our longer-term goal of supporting `~Copyable` in more places.
dc1bf91
to
68ae729
Compare
I think from SIL's perspective, it should only worry about whether the type is move-only. That includes MoveOnlyWrapped SILTypes and regular types that cannot be copied. Most of the code querying `SILType::isPureMoveOnly` is in SILGen, where it's very likely that the original AST type is sitting around already. In such cases, I think it's fine to ask the AST type if it is noncopyable. The clarity of only asking the ASTType if it's noncopyable is beneficial, I think.
7cb31a2
to
500a470
Compare
@swift-ci please smoke test |
This replaces the old, unavailable `_Copyable`. rdar://110420673
Have `~Copyable` change the signatures of a generic type param, protocol, or associated type if written in the inheritance clause position.
500a470
to
80097bc
Compare
@swift-ci please smoke test |
@swift-ci please smoke test linux platform |
slavapestov
reviewed
Sep 21, 2023
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR introduces the
NoncopyableGenerics
feature flag and should be a non-functional change when that feature is not enabled.When the flag is enabled:
Requirement
to beCopyable
, rather than synthesizing extra constraints in the solver.Copyable
requirement via~Copyable
from a protocol, associatedtype, or generic type parameter.~Copyable
in the inheritance clause of a struct/enum now doesn't actually make the type recognized as noncopyable to the rest of the compiler. That's because we need to move away from the MoveOnlyAttr. This will be fixed in another PR.This changeset is probably best reviewed one-commit-at-a-time.
resolves rdar://110420673&115812856