-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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
Tracking issue for ManuallyDrop::take
#55422
Comments
Add ManuallyDrop::take Tracking issue: rust-lang#55422 Proposed in this form in https://internals.rust-lang.org/t/mini-rfc-manuallydrop-take/8679, see that thread for some history. A small convenience wrapper for `ManuallyDrop` that makes a pattern (taking ownership of the contained data in drop) more obvious.
I am a bit worried about the name of this method being too innocent-looking. We have I'd prefer a name that already indicates this to be a dangerous operation. Strawman: |
Note that it has to be written as (Procedural note: I'll update OP with useful information soon.) |
@RalfJung I’m sympathetic to this argument, but we also have (I also notice that So I’m inclined to FCP to stabilize as-is. Or do you feel strongly we should rename? |
No, not very strongly. And not being able to say |
Anything blocking stabilization? I've wanted this method from time to time. |
The naming issue might be related to |
Anything that needs to be resolved for this to stabilize, libs? I just ended up here because someone on discord was just using |
The corresponding (unstable) method on |
This sounds reasonable. In fact both methods are implemented based on
@rust-lang/libs, what do you think? |
I think this method is only reasonable only if we don't have Is there some use case that can't be reasonably expressed using |
@HyeonuPark Note also that |
@CAD97 I agree |
@HyeonuPark The main use case is for in |
No, |
I'm going to de-nominate this because stabilization happens outside of triage meetings and happens when a libs team member feels confident enough to propose stabilization. |
Re: the parallel with |
I think Having said that, there is a difference in variance between the two, though I think it's a 100% pedantic difference. The
A
But as I said above, I'm pretty sure this is a very pedantic objection, as you have to go out of your way to see this difference in action. The following compiles just fine, with Rust coercing the lifetime after the
But I'm relatively new to thinking hard about variance, so if anyone thinks I missed something in the above I'd love to hear. :) |
|
Or alternatively we could deprecate |
@RalfJung So counter-argument to my "it should be clear" argument: How many people who are unfamiliar with |
IMO, anyone who sees |
I would like to stabilize this function as it is. For reference, here is the signature: impl<T> ManuallyDrop<T> {
pub unsafe fn take(slot: &mut ManuallyDrop<T>) -> T;
} @rfcbot fcp merge |
Team member @Amanieu has proposed to merge this. The next step is review by the rest of the tagged team members: No concerns currently listed. Once a majority of reviewers approve (and at most 2 approvals are outstanding), this will enter its final comment period. If you spot a major issue that hasn't been raised at any point in this process, please speak up! See this document for info about what commands tagged team members can give me. |
I went ahead and filed the stabilization PR at #68066 along with reclaimed doc improvements from the closed rename PR. |
🔔 This is now entering its final comment period, as per the review above. 🔔 |
The final comment period, with a disposition to merge, as per the review above, is now complete. As the automated representative of the governance process, I would like to thank the author for their work and everyone else who contributed. The RFC will be merged soon. |
This is a tracking issue for the function
ManuallyDrop::take
, gated on the featuremanually_drop_take
.Steps:
Unresolved questions:
ManuallyDrop::take
#55422 (comment))&Self
or&mut Self
? (Tracking issue forManuallyDrop::take
#55422 (comment))The text was updated successfully, but these errors were encountered: