Skip to content

[move-only] Emit an error if we /ever/ partially consume a noncopyable type. #66952

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

Conversation

gottesmm
Copy link
Contributor

The reason why I am doing this is that this was not part of the original
evolution proposal (it was called an extension) and after some discussion it was
realized that partial consumption would benefit from discussion on the forums.

rdar://111353459


I also needed to add a small optimization to eliminate some iterated copies that are inserted by SILGen since otherwise the diagnostic gets borked. It works by just walking def->uses and is very conservative by: 1. Only pattern matching a very exact sequence. 2. Making sure that all visited iterative copies are in the same block and do not have any side effects in the sequence of instructions.

@gottesmm
Copy link
Contributor Author

@swift-ci test

@gottesmm
Copy link
Contributor Author

@swift-ci test macOS platform

1 similar comment
@gottesmm
Copy link
Contributor Author

@swift-ci test macOS platform

@gottesmm gottesmm requested a review from jckarter June 27, 2023 14:46
gottesmm added 2 commits June 27, 2023 13:41
…ccessing fields of lets.

In the next commit, I am modifying the move only checker to ensure that we
always error when partially invalidating. While doing this I discovered that
these copies were getting in the way of emitting good diagnostics in that case.
…e type.

The reason why I am doing this is that this was not part of the original
evolution proposal (it was called an extension) and after some discussion it was
realized that partial consumption would benefit from discussion on the forums.

rdar://111353459
@gottesmm gottesmm force-pushed the pr-87fcc78991b465d8a15454dc76b66d6f347ddff0 branch from 05e54a3 to 3dde9df Compare June 27, 2023 20:53
@gottesmm
Copy link
Contributor Author

@swift-ci test

@gottesmm
Copy link
Contributor Author

@swift-ci test macOS platform

@gottesmm gottesmm merged commit bd90e31 into swiftlang:main Jun 28, 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