Skip to content

Implement checking for missing consume-on-all-paths of self in discard-ing contexts. #66190

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
Jun 5, 2023

Conversation

kavon
Copy link
Member

@kavon kavon commented May 27, 2023

As part of SE-390, you're required to write either:

  • consume self
  • pass self as a consuming parameter to a function
  • discard self

before the function ends in a context that contains a
discard self somewhere. This prevents people from accidentally
invoking the deinit due to implicit destruction of self before
exiting the function.

rdar://106099027

@kavon kavon force-pushed the discard-checking branch 3 times, most recently from b92e77a to f6d3cb2 Compare June 1, 2023 03:38
@kavon
Copy link
Member Author

kavon commented Jun 1, 2023

@swift-ci please smoke test

@kavon kavon force-pushed the discard-checking branch 2 times, most recently from d39e50d to 78c3c3b Compare June 3, 2023 01:32
As part of SE-390, you're required to write either:

  - `consume self`
  - pass self as a `consuming` parameter to a function
  - `discard self`

before the function ends in a context that contains a
`discard self` somewhere. This prevents people from accidentally
invoking the deinit due to implicit destruction of `self` before
exiting the function.

rdar://106099027
@kavon kavon force-pushed the discard-checking branch from 78c3c3b to 88d35a0 Compare June 5, 2023 01:45
@kavon kavon marked this pull request as ready for review June 5, 2023 01:47
@kavon kavon requested review from jckarter and gottesmm June 5, 2023 01:47
@kavon
Copy link
Member Author

kavon commented Jun 5, 2023

@swift-ci smoke test and merge

@kavon kavon changed the title Implement checking for misuse of self in discard-ing contexts. Implement checking for missing consume-on-all-paths of self in discard-ing contexts. Jun 5, 2023
@swift-ci swift-ci merged commit 4022edb into swiftlang:main Jun 5, 2023
@kavon kavon deleted the discard-checking branch June 5, 2023 07:28
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