Skip to content

[ownership] Allow mark_uninitialized to only take owned/none ownership parameters. #28876

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

Conversation

gottesmm
Copy link
Contributor

More explicitly, this disallows guaranteed values to be passed to
mark_uninitialized. From the perspective of OSSA, it only makes sense for
mark_uninitialized to consume its incoming parameter since we want the
underlying allocated value to have its "entire" lifetime "funnel" through the
mark_uninitialized.

Since if the input value is none, we still accept it, all mark_uninitialized on
pointers will not be affected by this.

NOTE: Today, mark_uninitialized can not even accept a borrow parameter (we
severely restrict what parameters it can take). So I can not actually even write
a test for this today since the verifier will run after parsing and assert. But
from a modeling perspective and from the perspective of not creating confusion,
specifying the ownership of mark_uninitialized more explicitly is good.

Given the note above this should actually be NFC since none of that specific set of instructions provide a guaranteed value. But future proofing/explicitness are overall good.

@gottesmm
Copy link
Contributor Author

@swift-ci smoke test

…p parameters.

More explicitly, this disallows guaranteed values to be passed to
mark_uninitialized. From the perspective of OSSA, it only makes sense for
mark_uninitialized to consume its incoming parameter since we want the
underlying allocated value to have its "entire" lifetime "funnel" through the
mark_uninitialized.

Since if the input value is none, we still accept it, all mark_uninitialized on
pointers will not be affected by this.

NOTE: Today, mark_uninitialized can not even accept a borrow parameter (we
severely restrict what parameters it can take). So I can not actually even write
a test for this today since the verifier will run after parsing and assert. But
from a modeling perspective and from the perspective of not creating confusion,
specifying the ownership of mark_uninitialized more explicitly is good.
@gottesmm gottesmm force-pushed the pr-f24fe5098010cb44c8efa616982a8f12720993d4 branch from e9351ff to b268698 Compare December 19, 2019 23:18
@gottesmm
Copy link
Contributor Author

@swift-ci smoke test and merge

4 similar comments
@gottesmm
Copy link
Contributor Author

@swift-ci smoke test and merge

@gottesmm
Copy link
Contributor Author

@swift-ci smoke test and merge

@gottesmm
Copy link
Contributor Author

@swift-ci smoke test and merge

@gottesmm
Copy link
Contributor Author

@swift-ci smoke test and merge

@swift-ci swift-ci merged commit 6508604 into swiftlang:master Dec 20, 2019
@gottesmm gottesmm deleted the pr-f24fe5098010cb44c8efa616982a8f12720993d4 branch December 20, 2019 02:31
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