[ownership] Allow mark_uninitialized to only take owned/none ownership parameters. #28876
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.
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.