Skip to content

temporarily prevent Copyable types from using consuming and borrowing #65570

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
May 4, 2023

Conversation

kavon
Copy link
Member

@kavon kavon commented May 2, 2023

There is a strong desire for "no-implicit-copy" semantics to be applied to Copyable values marked with the newer borrowing and consuming ownership specifiers. If we lock ourselves into what SE-390 specifies now for Copyable types in the implementation, then we'll have to introduce a source break when we want such values to have the desired semantics.

Before there's wider adoption, I'm making it an error to use those newer names. If for some reason this is enabling a critical optimization for your use case, please use the old names instead:

  • __owned for consuming parameters
  • __consuming for consuming methods
  • __shared for borrowing parameters

NOTE: the older names have their ownership attribute mangled into
the name of the function itself, so there's a possibility of ABI
breaks in the future if you move from the old name to the new one.
There is some consideration being made to allow for a migration to
the new names in the future without breaking ABI, so do reach out if
this is an issue for you.

resolves rdar://108538971

@kavon
Copy link
Member Author

kavon commented May 2, 2023

@swift-ci please test

@gottesmm
Copy link
Contributor

gottesmm commented May 2, 2023

@kavon this looks good to me. Except, can you add a flag that disables this for testing cases. Or change the tests that use this to use __shared/etc. Personally, I would rather the tests just have a special flag that way we future proof and don't have to change them in the future.

@kavon kavon force-pushed the ownership-specifiers-noncopyable-only branch 2 times, most recently from 7253a70 to 2b0bd31 Compare May 3, 2023 02:45
@kavon kavon force-pushed the ownership-specifiers-noncopyable-only branch from 2b0bd31 to 6b16b82 Compare May 3, 2023 02:54
@kavon
Copy link
Member Author

kavon commented May 3, 2023

@gottesmm I went with guarding the ability to write it behind NoImplicitCopy.

@kavon
Copy link
Member Author

kavon commented May 3, 2023

@swift-ci please test

@kavon kavon force-pushed the ownership-specifiers-noncopyable-only branch from 6b16b82 to fa7e628 Compare May 3, 2023 18:41
@kavon
Copy link
Member Author

kavon commented May 3, 2023

@swift-ci please smoke test

kavon added 2 commits May 3, 2023 13:47
…ing`

There is a strong desire for "no-implicit-copy" semantics to be
applied to Copyable values marked with the newer `borrowing` and
`consuming` ownership specifiers. If we lock ourselves into what
SE-390 specifies now for Copyable types in the implementation, then
we'll have to introduce a source break when we want such values to
have the desired semantics.

Before there's wider adoption, I'm making it an error to use those
newer names. If for some reason this is enabling a critical
optimization for your use case, please use the old names instead:

 - `__owned` for `consuming` parameters
 - `__consuming` for `consuming` methods
 - `__shared` for `borrowing` parameters

 NOTE: the older names have their ownership attribute mangled into
 the name of the function itself, so there's a possibility of ABI
 breaks in the future if you move from the old name to the new one.
 There is some consideration being made to allow for a migration to
 the new names in the future without breaking ABI, so do reach out if
 this is an issue for you.

 resolves rdar://108538971
@kavon kavon force-pushed the ownership-specifiers-noncopyable-only branch from fa7e628 to 87f190b Compare May 3, 2023 20:47
@kavon
Copy link
Member Author

kavon commented May 3, 2023

@swift-ci please smoke test

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